1035 Passwor
代码如下:
1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 struct person{ 5 string name; 6 string password; 7 }; 8 int main(){ 9 person p[1001]; 10 int a[1001]; 11 int n,count = 0; 12 bool flag = false; 13 cin >> n; 14 for(int i = 0; i < n; i++){ 15 cin >> p[i].name >> p[i].password; 16 for(int j = 0; j < p[i].password.size(); j++){ 17 if(p[i].password[j] == '1'){ 18 p[i].password[j] = '@'; 19 flag = true; 20 } 21 else if(p[i].password[j] == '0'){ 22 p[i].password[j] = '%'; 23 flag = true; 24 } 25 else if(p[i].password[j] == 'l'){ 26 p[i].password[j] = 'L'; 27 flag = true; 28 } 29 else if(p[i].password[j] == 'O'){ 30 p[i].password[j] = 'o'; 31 flag = true; 32 } 33 } 34 if(flag) a[count++] = i; 35 flag = false; 36 } 37 if(count == 0){ 38 if(n != 1) 39 cout << "There are " << n << " accounts and no account is modified" << endl; 40 else 41 cout << "There is 1 account and no account is modified" << endl; 42 } 43 else if(count != 0){ 44 cout << count << endl; 45 for(int i = 0; i < count; i++){ 46 cout << p[a[i]].name << " " << p[a[i]].password << endl; 47 } 48 } 49 return 0; 50 }