【PAT甲级】1116 Come on! Let's C (20分)
题意:
输入一个正整数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分)的更多相关文章
- 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 ...
- PAT 甲级 1116. Come on! Let's C (20) 【循环判断】
题目链接 https://www.patest.cn/contests/pat-a-practise/1116 思路 注意一个细节 如果没有本来 ID 的 后来又查了这个ID 不是输出 checked ...
- 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 ...
- 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 ...
- 【PAT甲级】1104 Sum of Number Segments (20 分)
题意:输入一个正整数N(<=1e5),接着输入N个小于等于1.0的正数,输出N个数中所有序列的和. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC ...
- 【PAT甲级】1058 A+B in Hogwarts (20 分)
题意: 输入两组,每组三个非负整数A,B,C(A<=1e7,B<17,C<29),输出相加的和.(类似个位上29进制,十位上17进制运算) AAAAAccepted code: #d ...
- 【PAT甲级】1031 Hello World for U (20 分)
题意: 输入一个字符串长度为5~80,以'U'型输出,使得底端一行字符数量不小于侧面一列,左右两列长度相等. trick: 不把输出的数组全部赋值为空格为全部答案错误,可能不赋值数组里值为0,赋值后是 ...
- 【PAT甲级】1023 Have Fun with Numbers (20 分)
题意: 输入一个不超过20位的正整数,问乘2以后是否和之前的数组排列相同(数字种类和出现的个数不变),输出Yes或No,并输出乘2后的数字. AAAAAccepted code: #define HA ...
- 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 ...
- PAT甲级:1064 Complete Binary Search Tree (30分)
PAT甲级:1064 Complete Binary Search Tree (30分) 题干 A Binary Search Tree (BST) is recursively defined as ...
随机推荐
- Java中顺序、并行与并发
顺序(sequential)用于表示多个操作依次处理.例如把十个操作交给一个人处理 并行(parallel)用于表示多个操作同时处理.比如是个操作分给两个人操作,两个人会并行处理 并发(concurr ...
- tomcat - 解决 org.bouncycastle.asn1.ASN1Boolean 非法循环依赖的错误
背景 记录遇到一次奇怪的错误,在发布war包到Tomcat的时候,出现了org.bouncycastle.asn1.ASN1Boolean非法循环依赖的错误. INFO: Deploying web ...
- 今日份Java
package util; import java.sql.*; public class DBUtil { static String url = "jdbc:mysql://localh ...
- 安装Gitlab到CentOS(YUM)
运行环境 系统版本:CentOS Linux release 7.3.1611 (Core) 软件版本:Gitlab-ce-11.10.1 硬件要求:最低2核4GB,建议4核8GB 安装过程 1.安装 ...
- Origin-作图相关
1.跨越缺失数据连接直线
- MySQL 8 服务器选项配置
查看服务器使用的默认命令选项和系统变量: mysqld --help --verbose 查看服务器当前运行时使用的系统变量和状态变量: mysql> SHOW VARIABLES; mysql ...
- 【spring】jdbcTemplate之sql参数注入
demo @Repository("jdbcDao") public class JdbcTemplateDao { @Autowired private JdbcTemplate ...
- canvas-画圆心的算法
公式为x=16sin~3t,y=(13cost-5cos2t-2cos3t-cos4t) x+r(16Math.pow(Math.sin(t),3)) y-r(13Math.cos(t)-5Math. ...
- sqli-labs5-10(全程sqlmap)
sqlmap注入教程:https://www.cnblogs.com/ichunqiu/p/5805108.html 前五关直接可以用默认的sqlmap语法跑: python sqlmap.py -u ...
- Win10下安装tensorflow详细过程
首先声明几点: 安装tensorflow是基于Python的,并且需要从Anaconda仓库中下载. 所以我们的步骤是:先下载Anaconda,再在Anaconda中安装一个Python,(你的电脑里 ...