解题代码
#include<iostream>
#include<string>
#include<map>
using namespace std;
map<string, string> m;
int main()
{
int N;
cin >> N;
char c;
string num, code;
for (int i = 0; i < N; i++) {
cin >> c >> num >> code;
if (c == 'N') {
if (m[num] == "") {
m[num] = code;
cout << "New: OK" << endl;
}
else cout << "ERROR: Exist" << endl;
}
else {
if (m[num] == "") cout << "ERROR: Not Exist" << endl;
else {
if (m[num] == code) cout << "Login: OK" << endl;
else cout << "ERROR: Wrong PW" << endl;
}
}
}
return 0;
}
测试结果
问题整理
1.基础题。