社区讨论
大佬们求助(28pts)
P5855 「SWTR-03」Password参与者 3已保存回复 5
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 5 条
- 当前快照
- 1 份
- 快照标识符
- @lpmo89kl
- 此快照首次捕获于
- 2023/12/01 21:39 2 年前
- 此快照最后确认于
- 2023/12/02 09:02 2 年前
CPP
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
ll n,k;
ll all=1;
cin>>n>>k;
string password;
cin>>password;
// cerr<<"password:"<<password<<endl;
string a[10010];
for(int i=1;i<=n;i++){
int x;
cin>>x>>a[i];
all*=x;
int len=a[i].size();
int cnt=0;
for(int j=0;j<len;j++){
// cerr<<"a["<<i<<"]["<<j<<"]="<<a[i][j]<<endl;
// cerr<<"password["<<i-1<<"]="<<password[i-1]<<endl;
if(a[i][j]==password[i-1]){
cnt++;
}
}
if(cnt==0){
cout<<-1<<endl;
return 0;
}
}
string b[10010];
int k1=k;
for(int i=1;i<=k;i++){
cin>>b[i];
int len=b[i].size();
int cnt=0;
for(int l=1;l<=n;l++){
for(int j=0;j<len;j++){
//cerr<<"b["<<l<<"]["<<j<<"]="<<b[l][j]<<endl;
//cerr<<"password["<<l-1<<"]="<<password[l-1]<<endl;
if(b[l][j]==password[l-1]){
cnt++;
}
}
}
if(cnt==0){
k1--;
}
}
cout<<all-k1<<endl;
return 0;
}
回复
共 5 条回复,欢迎继续交流。
正在加载回复...