7-15 QQ帐户的申请与登陆 (25 分)

#include 
#include 
#include 
#include 
using namespace std; 
int main(){
	int n;
	cin>>n;
	unordered_map<string, string> mp;
	unordered_map<string, bool> st;
	string ln, no, pw;
	while(n--){
		cin>>ln>>no>>pw;
		if(ln == "N"){
			if(st[no] == false){
				st[no] = true;
				cout<<"New: OK"<<endl;
				mp[no] = pw;
			}else{
				cout<<"ERROR: Exist"<<endl;
			}
		}else{
			if(st[no]==false) cout<<"ERROR: Not Exist"<<endl;
			else if(mp[no]==pw) cout<<"Login: OK"<<endl;
			else cout<<"ERROR: Wrong PW"<<endl;
		}
	}
	return 0;
}

你可能感兴趣的:(数据结构与算法题目集)