1035 Password
阿新 • • 發佈:2018-12-11
水題~
用string特別方便
#include <iostream> #include <cstring> #include <string> #include <sstream> #include <string> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #define maxn 1005 #define INF 0x3f3f3f3f #define EPS 1e-6 #defineView Codepi acos(-1.0) using namespace std; typedef long long ll; string name,pass; string ansn[maxn],ansp[maxn]; int main() { int n; cin>>n; int cnt=0; for(int i=0;i<n;i++) { cin>>name>>pass; int len=pass.length(); int mark=0; for(int j=0;j<len;j++) {if(pass[j]=='1') { pass[j]='@'; mark=1; } else if(pass[j]=='0') { mark=1; pass[j]='%'; } else if(pass[j]=='l') { mark=1; pass[j]='L'; } else if(pass[j]=='O') { mark=1; pass[j]='o'; } } if(mark) { ansn[cnt]=name; ansp[cnt]=pass; cnt++; } } if(cnt==0) { if(n==1) cout<<"There is 1 account and no account is modified"<<endl; else cout<<"There are "<<n<<" accounts and no account is modified"<<endl; } else { cout<<cnt<<endl; for(int i=0;i<cnt;i++) { cout<<ansn[i]<<" "<<ansp[i]<<endl; } } return 0; }