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. [ISSUE] [Centos] Centos Start Nginx Show: Failed to start nginx.service:unit not found

    CMD Line:systemctl start nginx.serviceFailed to start nginx.service: Unit not found. Solution: 1.vim ...

  2. STM32F103引脚功能定义

  3. 从centos镜像创建maven仓库

    创建镜像 1. 使用centos7作为基础镜像2. 将jdk1.8(官方要求1.8)和nexus3解压后的两个文件放进cp进去3. export环境变量后启动一下试一试4. docker commit ...

  4. ARM LCD屏调试3--屏的应用编程

    2011-06-25 19:20:47 驱动自己写完了,应用函数自己就不写了,找了一点代码参考,移植并修改了一下,配合之前的定义的接口文档,我贴出部分代码.目录: 一,开发环境... 1 二,底层函数 ...

  5. 配置React Native 安卓开发环境

    配置主要分为以下几步: 安装node.js 安装AndroidStudio 安装React Native命令行工具 搭建React Native版本的Hello World,修改代码查看效果 第一步 ...

  6. 利用Python计算π的值,并显示进度条

    利用Python计算π的值,并显示进度条  第一步:下载tqdm 第二步;编写代码 from math import * from tqdm import tqdm from time import ...

  7. linux awk用法

    awk是一个强大的文本分析工具,在对数据进行分析并生成报告时显得尤为强大. 使用方法:awk [options]  'BEGIN{ commands } pattern{ commands } END ...

  8. D9 图论综合题

    1.白银莲花池 LUOGU 2411 第一种思路:当然我们可以写三个bfs a掉这个题,这写下来一二百行要有了吧: 第二种:我们可以在一个bfs中维护所有的信息,一个方向数组,从起点开始,向八个方向扩 ...

  9. 主成分分析 SPSS、python实例分析

    今天,在西瓜书上看到了主成分分析法,之前建模有接触过但是理解不够深刻,今天再次和这一位老朋友聊聊. 主成分分析(Principal Component Analysis,PCA), 是一种统计方法.通 ...

  10. MySQL 增删改查

    增--添加数据 新建数据库 create database newdatabase; 选择数据库 use newdatabase; 新建表 create table newtable(id int,n ...