-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCome on! Let's C.cpp
68 lines (65 loc) · 1.31 KB
/
Come on! Let's C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
struct node
{
int rank = 0;
int flag;
};
node s[10010];
bool isprime(int v)
{
for (int i = 2; i < v; i++)
{
if (v % i == 0)
return false;
}
return true;
}
int main()
{
int n;
std::cin >> n;
for (int i = 0; i < n; i++)
{
int temp;
std::cin >> temp;
s[temp].rank = i + 1;
}
int k;
std::cin >> k;
for (int i = 0; i < k; i++)
{
int temp;
std::cin >> temp;
if (s[temp].rank == 0)
{
printf("%04d", temp);
std::cout << ": Are you kidding?" << std::endl;
}
else if (s[temp].flag == 1)
{
printf("%04d", temp);
std::cout << ": Checked" << std::endl;
}
else if (s[temp].rank == 1)
{
printf("%04d", temp);
std::cout << ": Mystery Award" << std::endl;
s[temp].flag = 1;
}
else
{
if (isprime(s[temp].rank))
{
printf("%04d", temp);
std::cout << ": Minion" << std::endl;
}
else
{
printf("%04d", temp);
std::cout << ": Chocolate" << std::endl;
}
s[temp].flag = 1;
}
}
return 0;
}