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 ...
随机推荐
- jQuery EasyUI 折叠面板accordion的使用实例
1.对折叠面板区域 div 设置 class=”easyui-accordion” 2.在区域添加多个 div, 每个 div 就是一个面板 (每个面板一定要设置 title 属性). 3.设置面板属 ...
- 图解Python的直接赋值与浅拷贝和深度拷贝三者区别
直接赋值:其实就是对象的引用(别名). 浅拷贝(copy):拷贝父对象,不会拷贝对象的内部的子对象. 深拷贝(deepcopy): copy 模块的 deepcopy 方法,完全拷贝了父对象及其子对象 ...
- python之路--前端CSS
一.CSS介绍 CSS(Cascading Style Sheet,层叠样式表)定义了如何显示HTML元素,给HTML设置样式,让他更加美观. 当浏览器读到这个样式表, 他就会按照这个样式来对文档进行 ...
- MongoDB学习目录
前面的话 为了能够使用NodeJS实现后端,MongoDB——这个NodeJS标配的数据库就不得不学.小火柴将MongoDB数据库的学习记录整理如下 基础 基础操作 数据类型 文档操作 索引 索引构建 ...
- Xamarin + MvvmCross 简单事例 Part 2
MvvmCross 说起MvvmCross,要先说到Mvvm,Mvvm是Mvc框架的一种变形.对应的分别为Model.View和ViewModel层.三层之间的关系是这样的: Model层为数据层,实 ...
- u盘中毒,启动显示找不到指定模块
u盘中毒,插入电脑,启动显示找不到指定模块,关闭杀毒软件还是这样: 小编经常是在学校教室的电脑上插入U盘再拔出就出现这样的情况,遇到N次了, 所以决定把方法记录下来: (演示使用的是win10系统,其 ...
- fastjson 操作
1.String 转 bean String addition = ...; CoffeeFormula formula = JSON.parseObject(addition, new TypeRe ...
- html概念
一.前端 1.什么是前端 前端即网站前台部分,运行在PC端等浏览器上展现给用户浏览的网页.随着互联网技术的发展, HTML5,CSS3,前端框架的应用,跨平台响应式网页设计能够适应各种屏幕分辨率,完美 ...
- 吉哥系列故事――恨7不成妻 HDU - 4507 数位dp
思路 和普通的DP不一样的是 这里求的是满足条件的数的平方的和 而数位DP只跟数每位是什么密切相关 所以要开一个结构 (多加一个 数的和sum 和平方和qsum)存一下各个状态的和的情况 dp[p ...
- HDU2204 Eddy's爱好
题意:给你一个正整数N,确定在1到N之间有多少个可以表示成M^K(K>1)的数. 解析:一个数N 开K次根后得到M 则小于M的所有数的K次方一定小于N 因为任何一个合数都能分解为素数的乘积 所 ...