1116 Come on! Let's C (20 分)
 

"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 (≤), the total number of contestants. Then N lines of the ranklist follow, each in order gives a contestant's ID (a 4-digit number). After the ranklist, there is a positive integer K followed by K query ID's.

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:

6
1111
6666
8888
1234
5555
0001
6
8888
0001
1111
2222
8888
2222

Sample Output:

8888: Minion
0001: Chocolate
1111: Mystery Award
2222: Are you kidding?
8888: Checked
2222: Are you kidding?
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; bool is_prime(int x){
for(int i=;i <= sqrt(x);i++){
if(x%i == ) return false;
}
return true;
} int main(){ int n;
cin >> n;
map<string,string> mp; for(int i=;i <= n;i++){
string s;
cin >> s;
if(i==){mp[s] = "Mystery Award";}
else if(is_prime(i)){mp[s] = "Minion";}
else if(!is_prime(i)){mp[s] = "Chocolate";}
} int q;
cin >> q;
while(q--){
string s;
cin >> s;
cout << s << ": ";
if(mp[s] == "")cout << "Are you kidding?"<< endl;
else if(mp[s] == "Checked") cout << "Checked" << endl;
else if(mp[s] == "Minion"){
cout << "Minion" << endl;
mp[s] = "Checked";
}
else if(mp[s] == "Mystery Award"){
cout << "Mystery Award" << endl;
mp[s] = "Checked";
}
else if(mp[s] == "Chocolate"){
cout << "Chocolate" << endl;
mp[s] = "Checked";
} } return ;
}

白给题,map的运用。

 

PAT 1116 Come on! Let's C的更多相关文章

  1. PAT 1116 Come on! Let's C [简单]

    1116 Come on! Let's C (20 分) "Let's C" is a popular and fun programming contest hosted by ...

  2. pat 1116 Come on! Let's C(20 分)

    1116 Come on! Let's C(20 分) "Let's C" is a popular and fun programming contest hosted by t ...

  3. PAT 甲级 1116. Come on! Let's C (20) 【循环判断】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1116 思路 注意一个细节 如果没有本来 ID 的 后来又查了这个ID 不是输出 checked ...

  4. 【PAT甲级】1116 Come on! Let's C (20分)

    题意: 输入一个正整数N(<=10000),接着依次输入N个学生的ID.输入一个正整数Q,接着询问Q次,每次输入一个学生的ID,如果这个学生的ID不出现在之前的排行榜上输出Are you kid ...

  5. PAT 甲级真题题解(63-120)

    2019/4/3 1063 Set Similarity n个序列分别先放进集合里去重.在询问的时候,遍历A集合中每个数,判断下该数在B集合中是否存在,统计存在个数(分子),分母就是两个集合大小减去分 ...

  6. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. PAT甲级目录

    树(23) 备注 1004 Counting Leaves   1020 Tree Traversals   1043 Is It a Binary Search Tree 判断BST,BST的性质 ...

  8. PAT甲级 散列题_C++题解

    散列 PAT (Advanced Level) Practice 散列题 目录 <算法笔记> 重点摘要 1002 A+B for Polynomials (25) 1009 Product ...

  9. 《转载》PAT 习题

    博客出处:http://blog.csdn.net/zhoufenqin/article/details/50497791 题目出处:https://www.patest.cn/contests/pa ...

随机推荐

  1. 【JavaScript】JS知识点复习

    1.引入的两种方式:直接在标签里行内js,在body最下端引入. 2.变量的5种类型:number,string,boolean,null,undefined以及一种特殊类型:object 3.变量命 ...

  2. mysql的group_concat列转行函数

    SELECT auditor,sum(count) total, GROUP_CONCAT(type,'=', count) AS type_count FROM auditor_dm_ol GROU ...

  3. XPosed 示例

    https://blog.csdn.net/fmc088/article/details/80535894

  4. linux 命令中英文对照,收集

    linux 命令中英文对照,收集   linux 命令英文全文 Is Linux CLI case-sensitive? The answer is, yes. If you try to run L ...

  5. megacli安装使用

    1.下载安装MegaCli64我这里下载的是MegaCli8.07.10.tar.gz 2.解压安装[root@localhost soft]# tar -xvf MegaCli8.07.10.tar ...

  6. redis4.0 cluster搭建

    cd /root/tools wget http://pnxcvm0bq.bkt.clouddn.com/redis-4.0.9.tar.gz tar -zxvf redis-4.0.9.tar.gz ...

  7. tcp的三次握手,四次挥手

    为了更好的记住知识点,所以将最近学习的知识点记录下来: 最开始A和B都处于closed(关闭连接状态) 1.tcp的第一次握手:客户端A  向服务器端B 发送请求连接报文段(包含SYN=1,初始序号s ...

  8. android sdk下载及安装教程

    转自https://www.cnblogs.com/summary-2017/p/8073225.html 1.点击这个网址https://www.androiddevtools.cn/,打开页面后选 ...

  9. 中间件详解,Django复习

    day74 2018-05-21 课程安排周一: 中间件 auth模块+分析BBS项目需求(小组讨论把表结构设计出来) 1. 今日内容 中间件:http://www.cnblogs.com/liwen ...

  10. WPF DataGrid 绑定行双击行命令

    WPF DataGrid 绑定行双击行命令 <DataGrid ...> <DataGrid.InputBindings> <MouseBinding MouseActi ...