1116 Come on! Let's C
Statement
Metadata
- 作者: CHEN, Yue
- 单位: 浙江大学
- 代码长度限制: 16 KB
- 时间限制: 200 ms
- 内存限制: 64 MB
"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:
- 0、 The Champion will receive a "Mystery Award" (such as a BIG collection of students' research papers…).
- 1、 Those who ranked as a prime number will receive the best award – the Minions (小黄人)!
- 2、 Everyone else will receive chocolates.
Given the final ranklist and a sequence of contestant ID's, you are supposed to tell the corresponding awards.
Input Specification
Each input file contains one test case. For each case, the first line gives a positive integer N (
Output Specification
For each query, print in a line ID: award
where the award is Mystery Award
, or Minion
, or Chocolate
. If the ID is not in the ranklist, print Are you kidding?
instead. If the ID has been checked before, print ID: Checked
.
Sample Input
Sample Output
8888: Minion
0001: Chocolate
1111: Mystery Award
2222: Are you kidding?
8888: Checked
2222: Are you kidding?
Solution
#include <ctype.h>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
bool isprime(int x) {
int m = sqrt(x) + 1;
for (int i = 2; i <= m; i++) {
if (x % i == 0)
return false;
}
return true;
}
int main() {
int n, num;
map<int, int> m, flag;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &num);
m[num] = i;
}
cin >> n;
for (int i = 0; i < n; i++) {
scanf("%d", &num);
printf("%04d: ", num);
int vis = m[num];
if (vis == 0)
printf("Are you kidding?\n");
else if (flag[num] == 1)
printf("Checked\n");
else if (vis == 1)
printf("Mystery Award\n");
else if (isprime(vis))
printf("Minion\n");
else if (m[num])
printf("Chocolate\n");
flag[num] = 1;
}
}