QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#46788#973. Composite SequenceUfowoqqqoWA 2ms3760kbC++598b2022-09-01 21:23:392022-09-01 21:23:41

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-01 21:23:41]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3760kb
  • [2022-09-01 21:23:39]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 100010;

int a[N];

bool check(int x)
{
    int i;

    for(i = 2; i * i <= x; i ++)
        if(x % i == 0)
            return false;

    return true;
}

int main()
{
    int n;
    int i;

    scanf("%d", &n);
    for(i = 0; i < n; i ++)
        scanf("%d", &a[i]);

    if(n > 2)
    {
        puts("Yes");
        return 0;
    }

    if(n == 1)
        puts(check(a[0]) ? "No" : "Yes");
    else
        puts(check(a[0]) && check(a[1]) && check(a[0] + a[1]) ? "No" : "Yes");

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3760kb

input:

2
5 7

output:

Yes

result:

ok "Yes"

Test #2:

score: 0
Accepted
time: 2ms
memory: 3744kb

input:

1
97

output:

No

result:

ok "No"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

1
97

output:

No

result:

ok "No"

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3736kb

input:

3
1 1 1

output:

Yes

result:

wrong answer 1st words differ - expected: 'No', found: 'Yes'