题目链接
关键点:
1、利用map来存注册的QQ,之后按照题目要求输出即可
完整代码:
# include <cstdio>
# include <iostream>
# include <map>
# include <cstring>
using namespace std;
int n;
map<string, string>mp;
int main()
{
cin>>n;
for (int i=1; i<=n; i++)
{
char ch;
string s, m;
scanf(" %c", &ch);
cin>>s>>m;
// cout<<ch<<" "<<s<<" "<<m<<endl;
if (ch=='N')
{
if (mp.find(s)==mp.end())
{
mp[s] = m;
cout<<"New: OK"<<endl;
}
else
{
cout<<"ERROR: Exist"<<endl;
}
}
else
{
if (mp.find(s)==mp.end())
{
cout<<"ERROR: Not Exist"<<endl;
}
else
{
if (mp[s]==m)
cout<<"Login: OK"<<endl;
else
cout<<"ERROR: Wrong PW"<<endl;
}
}
}
return 0;
}