日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

pat1035. Password (20)

發(fā)布時間:2024/4/17 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pat1035. Password (20) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1035. Password (20)

時間限制 400 ms 內(nèi)存限制 65536 kB 代碼長度限制 16000 B 判題程序 Standard 作者 CHEN, Yue

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 abcdefg222 team220 abcdefg333 Sample Output 3: There are 2 accounts and no account is modified

提交代碼

?

1 #include<cstdio> 2 #include<stack> 3 #include<algorithm> 4 #include<iostream> 5 #include<stack> 6 #include<set> 7 #include<map> 8 #include<vector> 9 using namespace std; 10 vector<string> v; 11 map<string,string> ha; 12 bool check(char &c){ 13 if(c=='1'){ 14 c='@'; 15 return true; 16 } 17 if(c=='0'){ 18 c='%'; 19 return true; 20 } 21 if(c=='l'){ 22 c='L'; 23 return true; 24 } 25 if(c=='O'){ 26 c='o'; 27 return true; 28 } 29 return false; 30 } 31 int main(){ 32 //freopen("D:\\INPUT.txt","r",stdin); 33 int n; 34 scanf("%d",&n); 35 int i,j; 36 string num,pas; 37 int count=0; 38 for(i=0;i<n;i++){ 39 cin>>num>>pas; 40 bool can=false; 41 for(j=0;j<pas.length();j++){ 42 if(check(pas[j])){ 43 can=true; 44 } 45 } 46 if(can){ 47 count++; 48 v.push_back(num); 49 ha[num]=pas; 50 } 51 } 52 if(count){ 53 printf("%d\n",count); 54 for(j=0;j<v.size();j++){ 55 cout<<v[j]<<" "<<ha[v[j]]<<endl; 56 } 57 } 58 else{ 59 if(n==1){ 60 printf("There is 1 account and no account is modified\n",n); 61 } 62 else{ 63 printf("There are %d accounts and no account is modified\n",n); 64 } 65 } 66 return 0; 67 }

?

轉(zhuǎn)載于:https://www.cnblogs.com/Deribs4/p/4782220.html

總結(jié)

以上是生活随笔為你收集整理的pat1035. Password (20)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。