1116. Come on! Let's C (20) <map>
来源:互联网 发布:json图片解析 编辑:程序博客网 时间:2024/06/16 04:14
"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:61111666688881234555500016888800011111222288882222Sample Output:
8888: Minion0001: Chocolate1111: Mystery Award2222: Are you kidding?8888: Checked2222: Are you kidding?
#include<cstdio>#include<cmath>#include<algorithm>#include<iostream>#include<cstring>#include<queue>#include<vector>#include<set>#include<map>#include<stack>using namespace std;int prime(int x){if(x==2||x==3) return 1;for(int i=2;i<=sqrt(x);i++) if(x%i==0) return 0;return 1;}int main(){int n;cin>>n;map<int,int> m;for(int i=0;i<n;i++){int num;cin>>num;m[num]=i+1; } int k;cin>>k;int v[10000]={0};for(int i=0;i<k;i++){int num;cin>>num;printf("%04d",num);if(v[num]){cout<<": Checked"<<endl; }else{if(m[num]!=0) v[num]=1;if(m[num]==0){cout<<": Are you kidding?"<<endl; } else if(m[num]==1){cout<<": Mystery Award"<<endl;} else if(prime(m[num])){cout<<": Minion"<<endl;}else{cout<<": Chocolate"<<endl;}}} return 0;}
- 1116. Come on! Let's C (20)[map]
- 1116. Come on! Let's C (20) <map>
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- 1116. Come on! Let's C (20)
- PAT1116. Come on! Let's C (map)
- 1116. Come on! Let's C
- PAT--1116. Come on! Let's C
- PAT 1116. Come on! Let's C
- 1116. Come on! Let's C
- 【PAT】1116. Come on! Let's C
- 【Android】源码分析
- 代理模式
- Android SwipeRefreshLayout下拉图片的修改
- 企业的名称和商号的区别
- 2017 Multi-University Training Contest
- 1116. Come on! Let's C (20) <map>
- 个人不熟悉的面试题目(操作系统)
- Tomcat源码解析(7)
- zabbix3.2监控日志脚本
- 看过三生三世的桃花,你吃过凌晨三点的桃子吗?
- Selenium + Headless Chrome with Python3
- Android 获取百度地图开发版和发布版sha1
- 51nod 1596 搬货物
- 设计模式之原型模式