1059. C Language Contest (20)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.