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;}
原创粉丝点击