PAT 甲级 1116. Come on! Let's C (20) 【循环判断】
题目链接
https://www.patest.cn/contests/pat-a-practise/1116
思路
注意一个细节
如果没有本来 ID 的 后来又查了这个ID 不是输出 checked 而是 Are you kidding?
AC代码
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>
#define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
bool isprime(int x)
{
int m = sqrt(x) + 1;
for (int i = 2; i <= m; i++)
{
if (x % i == 0)
return false;
}
return true;
}
int main()
{
int n, num;
map <int, int> m, flag;
cin >> n;
for (int i = 1; i <= n; i++)
{
scanf("%d", &num);
m[num] = i;
}
cin >> n;
for (int i = 0; i < n; i++)
{
scanf("%d", &num);
printf("%04d: ", num);
int vis = m[num];
if (vis == 0)
printf("Are you kidding?\n");
else if (flag[num] == 1)
printf("Checked\n");
else if (vis == 1)
printf("Mystery Award\n");
else if (isprime(vis))
printf("Minion\n");
else if (m[num])
printf("Chocolate\n");
flag[num] = 1;
}
}
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 甲级 1023 Have Fun with Numbers(20)(思路分析)
1023 Have Fun with Numbers(20 分) Notice that the number 123456789 is a 9-digit number consisting exa ...
- pat 甲级 1065. A+B and C (64bit) (20)
1065. A+B and C (64bit) (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming G ...
- PAT 甲级 1065. A+B and C (64bit) (20) 【大数加法】
题目链接 https://www.patest.cn/contests/pat-a-practise/1065 思路 因为 a 和 b 都是 在 long long 范围内的 但是 a + b 可能会 ...
- 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甲级——A1104 Sum of Number Segments【20】
Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 ...
- 【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 ...
随机推荐
- Android 使用内置的Camera应用程序捕获图像
本Demo的实现效果是调用手机上已安装的照相机来实现拍照的功能,拍好的照片以ImageView形式展示. 目的:学习手机调用安装的相机照相,对大的图片处理有所认识,这里主要用到BitmapFactor ...
- 自编自演的Linux脚本
启动全服务脚本 #!/bin/bash cd `` BIN_DIR=`pwd` COUNT= function deal(){ # ; #/stdout.log |grep -w 'Main serv ...
- 2017.2.28 activiti实战--第五章--用户与组及部署管理(二)部署流程资源
学习资料:<Activiti实战> 第五章 用户与组及部署管理(二)部署流程资源 内容概览:讲解流程资源的读取与部署. 5.2 部署流程资源 5.2.1 流程资源 流程资源常用的有以下几种 ...
- JAVA_Error initializing endpoint怎么办
1 运行CMD,输入命令netstat –ano,找到这个TCP,后缀为8080的PID(我的是2660),然后打开任务管理器,在进程选项卡中打开PID查看 2 在右侧的进程窗口找到PID是左侧的 ...
- poj 1328 Radar Installation 【贪心】【区间选点问题】
Radar Installation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 54798 Accepted: 12 ...
- java移位运算符详解
http://soft.chinabyte.com/database/195/11553695.shtml java移位运算符不外乎就这三种:<<(左移).>>(带符号右移)和 ...
- Solr局部或指定字段更新之set用法
solr wiki文档也有 http://yonik.com/solr/atomic-updates/ java code public static void up ...
- 【原创】基于.NET的轻量级高性能 ORM - TZM.XFramework
[前言] 接上一篇<[原创]打造基于Dapper的数据访问层>,Dapper在应付多表自由关联.分组查询.匿名查询等应用场景时不免显得吃力,经常要手写SQL语句(或者用工具生成SQL配置文 ...
- 性能测试框架Multi-Mechanize安装与使用
python模块介绍- multi-mechanize 通用的性能测试工具 简介 Multi-Mechanize 是一个开源的性能和负载测试框架,它并发运行多个 Python 脚本对网站或者服务生成负 ...
- Lua学习九----------Lua字符串
© 版权声明:本文为博主原创文章,转载请注明出处 1.Lua字符串 - ''单引号间的一串字符 - ""双引号之间的一串字符 - [[]]之间的一串字符 2.Lua转义字符 3.字 ...