The C-language contest is a joyous contest hosted by the Computer College of Zhejiang University. Since the main purpose of the competition is for fun, the awarding rules are very funny:
0. The champions will win a "mystery prize" (such as a huge collection of student research papers ...). )。
1. Students who are ranked as prime numbers will win the best prizes-the little yellow doll!
2. Other people will get chocolate.
Given the final position of the contest and the ID of the series of contestants, you should give the prizes that these contestants should receive.
Input format:
Enter the first line to give a positive integer n (<=10000), which is the number of entrants. The next n lines give the final rank, each row gives a contestant's ID (4 digits) in order of rank. Next, give a positive integer k and the ID of K that needs to be queried.
Output format:
For each ID you want to query, output the "ID: Prize" in one line, where the prize is either "Mystery Award" (Mystery Prize), or "Minion" (yellow person), or "chocolate" (chocolate). If the ID is not in the ranking at all, print "Is you kidding?" (Playing me?) )。 If the ID has already been checked (i.e. the prize has been taken), print "id:checked" (not Duochiduozhan).
Input Sample:
61111666688881234555500016888800011111222288882222
Sample output:
8888:minion0001:chocolate1111:mystery award2222:are kidding?8888:checked2222:are you kidding?
1#include <stdio.h>2#include <math.h>3#include <stdlib.h>4 intIsPrime (inta);5 intans[10005];6 intMain ()7 {8 intn,k,temp;9 inti;Tenscanf"%d",&n); One for(i=1; i<=n; i++) A { -scanf"%d",&temp); -Ans[temp]=i;//Hash Table the } -scanf"%d",&k); - for(i=0; i<k; i++) - { +scanf"%d",&temp); - if(ans[temp]==0) +printf"%04d:are you kidding?\n", temp); A Else if(ans[temp]==-1) atprintf"%04d:checked\n", temp); - //be careful to judge whether the award - Else if(ans[temp]==1) - { -printf"%04d:mystery award\n", temp); -ans[temp]=-1; in } - Else if(IsPrime (Ans[temp]))//determine if it is a prime number to { +printf"%04d:minion\n", temp); -Ans[temp] =-1; the } * Else $ {Panax Notoginsengprintf"%04d:chocolate\n", temp); -Ans[temp] =-1; the } + } A return 0; the } + - intIsPrime (inta) $ { $ intI,n; -n = (int) sqrt (a) +1; - for(i=2; i<n; i++) the { - if(a%i==0)Wuyi return 0; the } - return 1; Wu}
1059. C Language Contest (20)