题意:
输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改。输出修改过多少组密码并按输入顺序输出ID和修改后的密码,如果没有修改过就输出There are N accounts and no account is modified。(根据样例如果N==1,are改成is并且accounts不加s)
代码:
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char s[1007][17];
char x[1007][17];
int ans[1007];
int main(){
int n;
cin>>n;
int cnt=0;
for(int i=1;i<=n;++i){
cin>>x[i];
cin>>s[i];
int flag=0;
for(int j=0;s[i][j]!=0;++j){
if(s[i][j]==‘1‘)
s[i][j]=‘@‘,flag=1;
else if(s[i][j]==‘0‘)
s[i][j]=‘%‘,flag=1;
else if(s[i][j]==‘l‘)
s[i][j]=‘L‘,flag=1;
else if(s[i][j]==‘O‘)
s[i][j]=‘o‘,flag=1;
}
if(flag)
ans[++cnt]=i;
}
if(!cnt&&n==1)
cout<<"There is "<<n<<" account and no account is modified";
else if(!cnt&&n>1)
cout<<"There are "<<n<<" accounts and no account is modified";
else{
cout<<cnt<<"\n";
for(int i=1;i<=cnt;++i)
cout<<x[ans[i]]<<" "<<s[ans[i]]<<"\n";
}
return 0;
}
原文:https://www.cnblogs.com/ldudxy/p/11545381.html