水题
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 10;
struct node {
int id, rk;
string award;
bool valid, ischeck;
}a[maxn];
int n;
string list[3] = { "Mystery Award","Minion","Chocolate" };
bool isprime(int x)
{
if (x <= 1)return false;
for (int i = 2; i <= sqrt(x); i++)
{
if (x%i == 0)return false;
}
return true;
}
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
int id;
scanf("%d", &id);
a[id].id = id;
a[id].valid = true;
a[id].ischeck = false;
a[id].rk = i + 1;
if (a[id].rk == 1)a[id].award = list[0];
else if (isprime(a[id].rk))a[id].award = list[1];
else a[id].award = list[2];
}
int k;
scanf("%d", &k);
while (k--)
{
int query;
scanf("%d", &query);
printf("%04d", query);
if (a[query].valid == false)cout << ": Are you kidding?" << endl;
else if (a[query].valid&&a[query].ischeck == false)
cout <<": "<< a[query].award << endl, a[query].ischeck = true;
else if (a[query].valid&&a[query].ischeck)cout << ": Checked" << endl;
}
return 0;
}