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 (≤10​4​​), 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 <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
using namespace std;
const int MAX = ; int n;
// 0 Mystery Award 1 Minion 2 Chocolate
char s[MAX], ss[][MAX] = {{"Mystery Award"}, {"Minion"}, {"Chocolate"}};
map <string, int> mp;
set <string> st; bool is_prime(int x)
{
for (int i = ; i * i <= x; ++ i)
if (x % i == ) return false;
return true;
} int main()
{
// freopen("Date1.txt", "r", stdin);
scanf("%d%s", &n, &s);
mp[s] = ;
for (int i = ; i <= n; ++ i)
{
scanf("%s", &s);
if (is_prime(i)) mp[s] = ;
else mp[s] = ;
} scanf("%d", &n);
while (n --)
{
scanf("%s", &s);
if (st.find(s) != st.end()) printf("%s: Checked\n", s);
else if (mp.find(s) == mp.end()) printf("%s: Are you kidding?\n", s);
else
{
printf("%s: %s\n", s, ss[mp[s]]);
st.insert(s);
}
}
return ;
}

pat 1116 Come on! Let's C(20 分)的更多相关文章

  1. PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...

  2. PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...

  3. PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...

  4. PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642 题目描述: A reversible prime in any n ...

  5. PAT甲级:1136 A Delayed Palindrome (20分)

    PAT甲级:1136 A Delayed Palindrome (20分) 题干 Look-and-say sequence is a sequence of integers as the foll ...

  6. PAT乙级:1094 谷歌的招聘 (20分)

    PAT乙级:1094 谷歌的招聘 (20分) 题干 2004 年 7 月,谷歌在硅谷的 101 号公路边竖立了一块巨大的广告牌(如下图)用于招聘.内容超级简单,就是一个以 .com 结尾的网址,而前面 ...

  7. PAT乙级:1053 住房空置率 (20分)

    PAT乙级:1053 住房空置率 (20分) 题干 在不打扰居民的前提下,统计住房空置率的一种方法是根据每户用电量的连续变化规律进行判断.判断方法如下: 在观察期内,若存在超过一半的日子用电量低于某给 ...

  8. PAT乙级:1069 微博转发抽奖 (20分)

    PAT乙级:1069 微博转发抽奖 (20分) 题干 小明 PAT 考了满分,高兴之余决定发起微博转发抽奖活动,从转发的网友中按顺序每隔 N 个人就发出一个红包.请你编写程序帮助他确定中奖名单. 输入 ...

  9. PAT乙级:1092 最好吃的月饼 (20分)

    PAT乙级:1092 最好吃的月饼 (20分) 题干 月饼是久负盛名的中国传统糕点之一,自唐朝以来,已经发展出几百品种. 若想评比出一种"最好吃"的月饼,那势必在吃货界引发一场腥风 ...

  10. PAT乙级:1014 福尔摩斯的约会 (20分)

    PAT乙级:1014 福尔摩斯的约会 (20分) 题干 大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk ...

随机推荐

  1. MySQL make_set()的用法

    MAKE_SET(bits,str1,str2,…)返回一个设定值(含子字符串分隔字符串","字符),在设置位的相应位的字符串.str1对应于位0,str2到第1位,依此类推.在s ...

  2. Cocos2d-x 学习笔记(11.2) RotateBy RotateTo

    1. RotateBy RotateTo 两个旋转方法.RotateBy是在当前角度上旋转设置的角度.RotateTo是直接旋转到设置的角度,方向遵循“就近原则”.两者没有相互继承关系. 1.1 成员 ...

  3. 对新手严重不友好的强者——Nginx那些俯拾皆是的坑

    1.if和后边的括号要隔一个空格,变量后面也要有空格. 2.location / 和location = / 的意味不一样.前面的是通用匹配,后面的匹配根节点访问请求,前面的使用不好很容易引发重定向过 ...

  4. SpringMvc启动源码解析

    1. 前言 上篇文章介绍了Spring容器的初始化https://www.cnblogs.com/xiaobingblog/p/11738747.html,接下来介绍SpringMvc容器的初始化 2 ...

  5. 百万年薪python之路 -- 内置函数练习

    1.整理今天笔记,课上代码最少敲3遍. 2.用列表推导式做下列小题 过滤掉长度小于3的字符串列表,并将剩下的转换成大写字母 lst = [["a","b"],[ ...

  6. lable的渲染

    <StackPanel Margin=" TextOptions.TextFormattingMode="Display"> <Label TextOp ...

  7. Html.CSS.JavaScript 学习经验

    HTML里面 不要使用 document.getElementsByName() 来获取 元素,会出错. 使用 document.getElementById()更好一些. substring()首字 ...

  8. python wraps的作用

    1.__name__用来显示函数的名称,__doc__用来显示文档字符串也就是("""文档字符串""")这里面的内容 2.首先我们来看不加@ ...

  9. vue订阅者模式

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  10. FRP代理及其在数据库安全上的实践

    1 代理 现如今的互联网世界里,代理服务已经十分常见,它通常作为一个第三方或者说中转站角色替代用户取得信息或者服务. 根据代理对象的不同,代理服务可以分为正向代理和反向代理. 1.1 正向代理 我们通 ...