题目:https://pintia.cn/problem-sets/1268384564738605056/problems/1294124786527993858
题解:https://blog.csdn.net/qq_38558834/article/details/79730172
代码:
#include<iostream> #include<map> using namespace std; map<string,string> s; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ char c; string str1,str2; cin>>c>>str1>>str2; if(c==‘L‘){ if(s.find(str1)==s.end()) cout<<"ERROR: Not Exist"<<endl; // 在s中没有找到此QQ号 else if(s[str1]!=str2) cout<<"ERROR: Wrong PW"<<endl; //找到了但是密码不对 else cout<<"Login: OK"<<endl; //找到了,密码也对 } else { if(s.find(str1)!=s.end()) cout<<"ERROR: Exist"<<endl; else { cout<<"New: OK"<<endl; s[str1] = str2; } } } return 0; }
原文:https://www.cnblogs.com/simon-chou/p/13620151.html