首页 > 代码库 > PAT 1034
PAT 1034
注意看后面output的要求OTL
陈越姥姥我都不太想吐槽你了...
1 #include <vector> 2 #include <iostream> 3 #include <string> 4 #include <fstream> 5 6 #define OJ 7 8 #ifdef OJ 9 #define fin cin10 #endif11 12 using namespace std;13 14 class User{15 public:16 User(){17 modified = false;18 }19 20 string name;21 string passwd;22 bool modified;23 };24 25 vector<User> users;26 27 int main(){28 #ifndef OJ29 ifstream fin;30 fin.open("in.data");31 #endif32 33 34 int N;35 fin >> N;36 37 for (int i = 0; i < N; i++){38 User user;39 fin >> user.name >> user.passwd;40 users.push_back(user);41 }42 43 int mod_cnt = 0;44 for (int i = 0; i < N; i++){45 User &user = users[i];46 string &str = user.passwd;47 for (int j = 0; j < str.size(); j++){48 bool modified = true;49 if (str[j] == ‘1‘)50 str[j] = ‘@‘;51 else if (str[j] == ‘0‘)52 str[j] = ‘%‘;53 else if (str[j] == ‘l‘)54 str[j] = ‘L‘;55 else if (str[j] == ‘O‘)56 str[j] = ‘o‘;57 else58 modified = false;59 60 user.modified |= modified;61 }62 if (user.modified)63 mod_cnt++;64 }65 66 if (mod_cnt == 0){67 cout << "There " << (N == 1 ? "is " : "are ") << N << (N == 1 ? " account" : " accounts") << " and no account is modified" << endl;68 69 return 0;70 }71 72 cout << mod_cnt << endl;73 for (int i = 0; i < N; i++){74 User &user = users[i];75 if (user.modified){76 cout << user.name << " " << user.passwd << endl;77 }78 }79 80 return 0;81 }
PAT 1034
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。