AcWing 1606. C 语言竞赛
原题链接
简单
作者:
Value
,
2020-05-31 16:09:49
,
所有人可见
,
阅读 448
#include <iostream>
#include <unordered_map>
using namespace std;
unordered_map<string, int> mp;
const int N = 1E4 + 10;
bool prime[N];
void init(){
for(int i = 2; i < N; i ++ ){
if(!prime[i]) for(int k = i * i; k < N; k += i ) prime[k] = true;
}
}
int main(){
init();
int n;
cin >> n;
string sno;
for(int i = 1; i <= n; i ++ ){
cin >> sno;
mp[sno] = i;
}
cin >> n;
while(n -- ){
cin >> sno;
cout << sno << ": ";
if(mp.find(sno) == mp.end()) cout << "Are you kidding?";
else{
if(mp[sno] == -1) cout << "Checked";
else if(mp[sno] == 1) cout << "Mystery Award";
else if(!prime[mp[sno]]) cout << "Minion";
else cout << "Chocolate";
mp[sno] = -1;
}
if(n) cout << endl;
}
}