1116 Come on! Let's C (20 分)
水题~。
unordered_map<string,string> mp;
unordered_set<string> S;
int n,m;
bool isprime(int n)
{
for(int i=2;i*i<=n;i++)
if(n % i == 0)
return false;
return true;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
string name;
cin>>name;
int rank=i+1;
string award;
if(rank == 1)
award="Mystery Award";
else if(isprime(rank))
award="Minion";
else
award="Chocolate";
mp[name]=award;
}
cin>>m;
while(m--)
{
string name;
cin>>name;
if(!mp.count(name))
cout<<name<<": "<<"Are you kidding?"<<endl;
else if(S.count(name))
cout<<name<<": "<<"Checked"<<endl;
else
cout<<name<<": "<<mp[name]<<endl;
S.insert(name);
}
//system("pause");
return 0;
}