多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > 1035. Password (20)

1035. Password (20)

來源:程序員人生   發布時間:2015-05-21 08:07:53 閱讀次數:2561次

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase). One solution is to replace 1 (one) by @, 0 (zero) by %, l by L, and O by o. Now it is your job to write a program to check the accounts generated by the judge, and to help the juge modify the confusing passwords.

Input Specification:

Each input file contains one test case. Each case contains a positive integer N (<= 1000), followed by N lines of accounts. Each account consists of a user name and a password, both are strings of no more than 10 characters with no space.

Output Specification:

For each test case, first print the number M of accounts that have been modified, then print in the following M lines the modified accounts info, that is, the user names and the corresponding modified passwords. The accounts must be printed in the same order as they are read in. If no account is modified, print in one line "There are N accounts and no account is modified" where N is the total number of accounts. However, if N is one, you must print "There is 1 account and no account is modified" instead.

Sample Input 1:

3

Team000002 Rlsp0dfa

Team000003 perfectpwd

Team000001 R1spOdfa

Sample Output 1:

2

Team000002 RLsp%dfa

Team000001 R@spodfa

Sample Input 2:

1

team110 abcdefg332

Sample Output 2:

There is 1 account and no account is modified

Sample Input 3:

2

team110 abcdefg222team220 abcdefg333

Sample Output 3:

There are 2 accounts and no account is modified


#include <iostream> #include <string> using namespace std; struct user { string name; string password; bool flag; }; bool password(user &a) { int i; bool flag = false; for(i = 0 ; i < a.password.length(); i++) { switch(a.password[i]) { case '1': flag = true; a.password[i] = '@'; break; case '0': flag = true; a.password[i] = '%'; break; case 'l': flag = true; a.password[i] = 'L'; break; case 'O': flag = true; a.password[i] = 'o'; break; default: continue; } } return flag; } int main() { struct user user[1001]; int n, i; while(cin>>n) { int count = 0; for(i=0; i<n; i++) { cin>>user[i].name>>user[i].password; user[i].flag = false; } for(i=0; i<n; i++) { if(password(user[i])) { user[i].flag = true; count++; } } if(count>0) { cout<<count<<endl; for(i=0; i<n; i++) { if(user[i].flag) { cout<<user[i].name<<" "<<user[i].password<<endl; } } } else { 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; } } } return 0; }


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 男女自偷自拍视频免费观看篇 | 午夜亚洲国产理论秋霞 | 欧美 日韩 亚洲 中文字幕 一区 | 最近中文字幕视频在线资源 | 国产精品亚洲午夜一区二区三区 | 国产精品日韩欧美久久综合 | xxxxx视频| 亚洲精品第一区二区在线 | 日韩理论片在线观看 | 欧美成人h版在线观看 | 亚洲欧美日韩综合一区 | 日韩欧美一区二区三区 | 国产精品久久久久久久免费大片 | 欧美一区二区三区精品 | 五月天婷婷在线视频国产在线 | 伊人免费网 | 欧美一区亚洲二区 | 欧美精品久久久久久久久大尺度 | 欧美日韩一二 | 免费福利网站在线观看 | 亚洲一区国产 | 亚洲天堂中文字幕在线 | 国内视频精品 | 日本一区二区高清 | 国产成人高清亚洲一区久久 | 日本做爰免费大片视频 | 亚洲一二三区在线观看 | 日韩福利网 | 欧美日韩欧美日韩 | 操片| 亚洲第一天堂无码专区 | 欧美最猛同性video | 欧美另类亚洲一区二区 | 一本大道香蕉久在线不卡视频 | 国产成人精品在视频 | 伊人成综合 | 99视频精品全部免费免费观 | 国产一区精品 | 久久大香伊人中文字幕 | 真人肉体一级毛片 | 中文字幕欧美一区 |