SDUT 3920 Special Judge Ⅱ
来源:互联网 发布:sublimetext3 python 编辑:程序博客网 时间:2024/06/05 03:39
SDUT 3920 Special Judge Ⅱ
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
Q:什么是 Special Judge,Special Judge 的题目有什么不同?
A:一个题目可以接受多种正确答案,即有多组解的时候,题目就必须被 Special Judge。Special Judge 程序使用输入数据和一些其他信息来判答程序的输出,并将判答结果返回。
NaYe 最近遇到了一个题,要求输出三个数,第三个数为前两个数的和,三个数都是素数,且前两个数小于 500000。他只需要输出任意一组符合要求的答案即认为是 Accepted。现在需要你做的是判断 NaYe 的程序运行结果对不对。
Input
输入数据有多组(数据组数不超过 100),到 EOF 结束。
对于每组数据,输入 a, b, c 三个整数。含义同题目描述。
a, b, c 均在 int 范围内。
Output
对于每组数据,如果 NaYe 的程序正确输出 “Accepted”,否则输出 “Wrong Answer”(输出不包括引号)。
Example Input
1 1 1
2 3 5
3 5 8
Example Output
Wrong Answer
Accepted
Wrong Answer
Author
「“师创杯”山东理工大学第九届ACM程序设计竞赛 热身赛」MLE_kenan
Submit
#include <bits/stdc++.h>using namespace std;int prime[1000000];int isprime(int x){ for(int i = 2; i <= sqrt(x); i++) if(x % i == 0) return 0; return 1;}void mems(){ memset(prime, -1, sizeof(prime)); prime[0] = 0; prime[1] = 0; for(int i = 2; i < 1000000; i++) { if(prime[i] != -1) continue; if(isprime(i)) { prime[i] = 1; for(int j = i * 2; j < 1000000; j += i) prime[j] = 0; } else prime[i] = 0; }}int main(){ int a, b, c; mems(); while(~scanf("%d%d%d", &a, &b, &c)) { if(a + b == c && a < 500000 && b < 500000 && c < 1000000) { if(prime[a] && prime[b] && prime[c]) printf("Accepted\n"); else printf("Wrong Answer\n"); } else printf("Wrong Answer\n"); } return 0;}
阅读全文
0 0
- SDUT 3920 Special Judge Ⅱ
- SDUT 3919 Special Judge Ⅰ
- SDUT 3921 Special Judge Ⅲ
- Special Judge Ⅱ
- Special Special Judge III ZOJ
- coj 1344: Special Judge
- Special Judge Ⅰ
- zoj3411-Special Special Judge-高精度dp
- 1721. Gray code[Special judge]
- 1721. Gray code[Special judge]
- [sicily]1151. 魔板[Special judge]
- [sicily]1151. 魔板[Special judge]
- 简单魔板[Special judge]
- 【POI2001】和平委员会(Special Judge)
- 从零开始写OJ---Special Judge
- poj1015 背包/动态规划(Special Judge,Special Love)
- ZOJ3413 Special Special Judge III(数形结合)
- 【图论】【RQNOJ】心许的回忆[Special Judge]
- js 获取多选框CheckBox选中及选中值
- 1222: 排序
- [JavaEE] 使用Apache Common Lang包中的 EqualsBuilder和HashCodeBuilder
- Mybatis id自增,插入数据后返回id
- 物资调度
- SDUT 3920 Special Judge Ⅱ
- Java内存模型
- git常用命令-工作中常用
- FZU-Problem 2191 完美的数字
- jQuery/表单校验
- hihocoder1015(KMP模板)
- linux之firewalld
- TensorFlow学习笔记(10)--实现AlexNet
- Codeforces Round #416 (Div. 2) C Vladik and Memorable Trip