题意:

输入一个正整数N(<=10000),接着依次输入N个学生的ID。输入一个正整数Q,接着询问Q次,每次输入一个学生的ID,如果这个学生的ID不出现在之前的排行榜上输出Are you kidding,否则如果已经询问过输出Checked,否则如果这位学生排名第一输出Mystery Award,否则如果这位学生的排名是质数输出Minion,否则输出Chocolate。

AAAAAccepted code:

 #define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int a[];
int vis[];
int main(){
//ios::sync_with_stdio(false);
//cin.tie(NULL);
//cout.tie(NULL);
int n;
scanf("%d",&n);
for(int i=;i<=n;++i){
int x;
scanf("%d",&x);
a[x]=i;
vis[x]=;
}
int q;
scanf("%d",&q);
for(int i=;i<=q;++i){
int x;
scanf("%d",&x);
if(vis[x]==)
printf("%04d: Are you kidding?\n",x);
else if(vis[x]==)
printf("%04d: Checked\n",x);
else if(vis[x]==){
vis[x]=;
int flag=;
for(int j=;j*j<=a[x];++j)
if(a[x]%j==)
flag=;
if(a[x]==)
printf("%04d: Mystery Award\n",x);
else if(flag==)
printf("%04d: Minion\n",x);
else if(flag==)
printf("%04d: Chocolate\n",x);
}
}
return ;
}

【PAT甲级】1116 Come on! Let's C (20分)的更多相关文章

  1. PAT甲级:1124 Raffle for Weibo Followers (20分)

    PAT甲级:1124 Raffle for Weibo Followers (20分) 题干 John got a full mark on PAT. He was so happy that he ...

  2. PAT 甲级 1116. Come on! Let's C (20) 【循环判断】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1116 思路 注意一个细节 如果没有本来 ID 的 后来又查了这个ID 不是输出 checked ...

  3. PAT 甲级 1069 The Black Hole of Numbers (20 分)(内含别人string处理的精简代码)

    1069 The Black Hole of Numbers (20 分)   For any 4-digit integer except the ones with all the digits ...

  4. PAT 甲级 1065 A+B and C (64bit) (20 分)(溢出判断)*

    1065 A+B and C (64bit) (20 分)   Given three integers A, B and C in [−], you are supposed to tell whe ...

  5. 【PAT甲级】1104 Sum of Number Segments (20 分)

    题意:输入一个正整数N(<=1e5),接着输入N个小于等于1.0的正数,输出N个数中所有序列的和. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC ...

  6. 【PAT甲级】1058 A+B in Hogwarts (20 分)

    题意: 输入两组,每组三个非负整数A,B,C(A<=1e7,B<17,C<29),输出相加的和.(类似个位上29进制,十位上17进制运算) AAAAAccepted code: #d ...

  7. 【PAT甲级】1031 Hello World for U (20 分)

    题意: 输入一个字符串长度为5~80,以'U'型输出,使得底端一行字符数量不小于侧面一列,左右两列长度相等. trick: 不把输出的数组全部赋值为空格为全部答案错误,可能不赋值数组里值为0,赋值后是 ...

  8. 【PAT甲级】1023 Have Fun with Numbers (20 分)

    题意: 输入一个不超过20位的正整数,问乘2以后是否和之前的数组排列相同(数字种类和出现的个数不变),输出Yes或No,并输出乘2后的数字. AAAAAccepted code: #define HA ...

  9. PAT甲级:1066 Root of AVL Tree (25分)

    PAT甲级:1066 Root of AVL Tree (25分) 题干 An AVL tree is a self-balancing binary search tree. In an AVL t ...

  10. PAT甲级:1064 Complete Binary Search Tree (30分)

    PAT甲级:1064 Complete Binary Search Tree (30分) 题干 A Binary Search Tree (BST) is recursively defined as ...

随机推荐

  1. MySql优化之主从复制

    第一步: 配置节点信息(配置完毕重启mysql) 找到my.cnf配置文件,这个文件在etc目录下使用命令修改my.cnf文件 vi /etc/my.cnf 主节点配置: server-id =55 ...

  2. jQuery---表格删除案例

    表格删除案例 on的简单事件 //1. 找到清空按钮,注册点击事件,清空tbody $("#btn").on("click", function () { $( ...

  3. sqlserver2014部署安装

    百度云网址链接: https://pan.baidu.com/s/1BwgdnESI8Fqlos9EIOLv1A 提取码: wsy5 1.解压ISO镜像文件,点击setup安装程序 2.进入安装界面 ...

  4. nginx 反向代理及 https 证书配置

    nginx 反向代理及 https 证书配置 author: yunqimg(ccxtcxx0) 1. 编译安装nginx 从官网下载 nginx源码, 并编译安装. ./configure --pr ...

  5. 删除Win10菜单中的幽灵菜单(ms-resource:AppName/Text )

    新建一个 .bat文件,输入以下内容 @echo off taskkill /f /im explorer.exe taskkill /f /im shellexperiencehost.exe ti ...

  6. Qt实践-基于C++的UI设计基础

    学习网址:http://c.biancheng.net/view/1824.html 我的代码: 头文件qwdlgmanual.h: #ifndef QWDLGMANUAL_H #define QWD ...

  7. ECMAScript基本对象——String 对象

    对象用于处理文本(字符串). 1.创建 var txt = new String("string"); var txt = "string"; 2.方法 cha ...

  8. ASP.NET Identity系列教程-2【Identity入门】

    https://www.cnblogs.com/r01cn/p/5177708.html13 Identity入门 Identity is a new API from Microsoft to ma ...

  9. CTF伪协议+preg_replace()函数的代码执行

    一道学习中所遇到的ctf 步骤: 我们点击题目链接,然后在页面先点击”云平台后台管理中心“ 然后url后面跟了参数page,题目提示了一个文件包含,我们试试index.php 看到了输出了ok,应该是 ...

  10. 题解【洛谷P3456】[POI2007]GRZ-Ridges and Valleys

    题面 考虑 \(\text{Flood Fill}\). 每次在 \(\text{BFS}\) 扩展的过程中增加几个判断条件,记录山峰和山谷的个数即可. #include <bits/stdc+ ...