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 ...
随机推荐
- linux audit审计(5)--audit规则配置
audit可以配置规则,这个规则主要是给内核模块下发的,内核audit模块会按照这个规则获取审计信息,发送给auditd来记录日志. 规则类型可分为: 1.控制规则:控制audit系统的规则: 2.文 ...
- MySQL系列:索引基本操作(4)
1. 索引简介 索引是一种特殊的数据库结构,可以用来快速查询数据中的特定记录. MySQL中索引包括:普通索引.唯一性索引.全文索引.单列索引.多列索引和空间索引等. 1.1 索引定义 索引由数据库表 ...
- 莫烦scikit-learn学习自修第五天【训练模型的属性】
1.代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ from sklearn import datasets from sklearn.linear ...
- mybatis generator的maven插件,找不到properties的配置文件错误的解决
第一次运行的时候,maven插件是正确运行了的 但后面对 maven 的 build节点做了一点修改,就开始报错,找不到 properties标签指定的的数据库连接配置文件了 修改部分如下: 这个操作 ...
- 导出数据到EXL表格中
项目使用的是SSI框架,通过struts访问到action xml文件: <action name="fabAttributedaochu" class="com. ...
- python 基础篇
1.编程语言介绍. 1.机器语言:直接用二进制编程,直接对硬件的控制,需对硬件掌握比较深. 优点:执行效率快 缺点:开发效率低下 2.汇编语言:用英文标签代替二进制编写程序,直接对硬件的控制,需对硬件 ...
- 官网下载旧版本jdk,老版本jdk,jdk1.7,jdk1.8
1.进入中文oracle官网(不是国内官网下载速度超级慢): http://www.oracle.com/technetwork/cn/indexes/downloads/index.html 2.进 ...
- 在 Web 页面使用 VLC 插件播放 m3u8 视频流 (360 极速模式)
1. 背景 公司有个旧项目需要添加在线播放 m3u8 视频流,但是该流不知道什么原因使用 Video.js 或 hls.js 均无法播放,最后找到解决方案可使用 VLC 插件播放(360 极速模式下) ...
- Linux命令替换字符串
:%s/str1/str2/ 用str2替换str1
- 微服务 Micro services
微服务 (Microservices) 是一种软件架构风格,它是以专注于单一责任与功能的小型功能区块 (Small Building Blocks) 为基础,利用模组化的方式组合出复杂的大型应用程序, ...