A1116. Come on! Let's C
"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 (<=10000), 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<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<math.h>
using namespace std;
int tb[] = {}, N, K;
int isPrime(int n){
int sqr = sqrt(n * 1.0);
if(n == )
return ;
for(int i = ; i <= sqr; i++){
if(n % i == )
return ;
}
return ;
}
char str[][] = {"Are you kidding?", "Mystery Award", "Minion", "Chocolate", "Checked"};
int main(){
scanf("%d", &N);
int temp;
for(int i = ; i <= N; i++){
scanf("%d", &temp);
if(i == ){
tb[temp] = ;
}else if(isPrime(i) == ){
tb[temp] = ;
}else tb[temp] = ;
}
scanf("%d", &K);
for(int i = ; i < K; i++){
scanf("%d", &temp);
printf("%04d: %s\n", temp, str[tb[temp]]);
if(tb[temp] != )
tb[temp] = ;
}
cin >> N;
return ;
}
A1116. Come on! Let's C的更多相关文章
- PAT甲级——A1116 Come on! Let's C
"Let's C" is a popular and fun programming contest hosted by the College of Computer Scien ...
- 玩玩LED点阵屏(arduino nano)
做些记录,特别是led显示左移效果的代码,二进制位的特效函数 unsigned ][]= { 0xff,0xd7,0x83,0xd6,0xc6,0xd4,0xc6,0x82,0xd6,0xba,0xf ...
- 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 ...
- ASP.NET MVC 使用 Datatables (1)
具体步骤: 1.建立实体类 public class Asset { public System.Guid AssetID { get; set; } [Display(Name = "Ba ...
- PAT (Advanced Level) Practice(更新中)
Source: PAT (Advanced Level) Practice Reference: [1]胡凡,曾磊.算法笔记[M].机械工业出版社.2016.7 Outline: 基础数据结构: 线性 ...
- PAT_A1116#Come on! Let's C
Source: PAT A1116 Come on! Let's C (20 分) Description: "Let's C" is a popular and fun prog ...
随机推荐
- Android——MaterialDesign之二DrawerLayout
滑动菜单--DrawerLayout 滑动菜单就是把一些菜单选项隐藏起来,而不是放置主屏幕中,然后可以通过滑动的方式将菜单显示出来,具有非常的画面效果,就是类似侧边滑动. 例子:需要上一次的Toolb ...
- python爬虫scrapy之如何同时执行多个scrapy爬行任务
背景: 刚开始学习scrapy爬虫框架的时候,就在想如果我在服务器上执行一个爬虫任务的话,还说的过去.但是我不能每个爬虫任务就新建一个项目吧.例如我建立了一个知乎的爬行任务,但是我在这个爬行任务中,写 ...
- git基本操作1
1.创建版本库 在文件夹下,打开Git Bash Here ,然后执行git init,文件夹中会多出.git文件夹.(.git可能是隐藏的) 2.创建a.txt vim a.txt ,并添加到版本 ...
- java构造器和构建器
本文摘自:https://blog.csdn.net/wh2827991/article/details/79013115 在实例化一个类的过程中,通常会遇到多个参数的构造函数,但如果有些参数是非必需 ...
- 使用layui 做后台管理界面,在Tab中的链接点击后添加一个新TAB的解决方法
给链接或按钮 添加 onclick="self.parent.addTab('百度','http://www.baidu.com','icon-add')" 如: <a h ...
- NPOI 上传Excel功能(二)
3.上传文件,写入log using DC.BE.Business.SYS; using DC.BE.Entity.ERP; using DC.BE.Entity.SAS; using DC.BE.E ...
- SQL Server中获取指定时间段内的所有月份
例如查询 2012-1-5 到 2012-11-3 之间所有的月份 declare @begin datetime,@end datetime set @begin='2012-1-5' set @e ...
- Detected problems with API compatibility(visit g.co/dev/appcompat for more info)
应用开启了debug模式导致Android 9提示如此,使用release模式即可解决.
- Android InputType
转载: http://blog.csdn.net/wei_zhi/article/details/50094503 在Android开发过程中,我们经常使用到EditText控件,并且会根据各种需求设 ...
- JS的初步了解
JavaScript 是互联网上最流行的脚本语言,这门语言可用于 HTML 和 web,更可广泛用于服务器.PC.笔记本电脑.平板电脑和智能手机等设备.JavaScript 是脚本语言 HTML 中的 ...