ZOJ 2514 Generate Passwords 水
啦啦啦,水一发准备去复习功课~
------------------------------------------水一发的分割线------------------------------------------
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1514
水题,没有一次AC我很惭愧,竟然忘了输出总共的个数。。。。。
#include<cstdio> #include<cstring> const int MAXN=1000; struct data { bool ok; char user[12]; char password[12]; }a[MAXN]; int main() { int n; while(~scanf("%d",&n),n) { for(int i=0;i<n;i++) { scanf("%s%s",a[i].user,a[i].password); a[i].ok=false; } int cnt=0; for(int i=0;i<n;i++) { int len=strlen(a[i].password); for(int j=0;j<len;j++) { if(a[i].password[j]=='1') { a[i].password[j]='@'; a[i].ok=true; } else if(a[i].password[j]=='0') { a[i].password[j]='%'; a[i].ok=true; } else if(a[i].password[j]=='O') { a[i].password[j]='o'; a[i].ok=true; } else if(a[i].password[j]=='l') { a[i].password[j]='L'; a[i].ok=true; } } if(a[i].ok) cnt++; } if(cnt==0) printf("No account is modified.\n"); else { printf("%d\n",cnt); for(int i=0;i<n;i++) { if(a[i].ok) { printf("%s %s\n",a[i].user,a[i].password); } } } } return 0; }
新 blog : www.hrwhisper.me