QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#46811 | #973. Composite Sequence | Ufowoqqqo | WA | 2ms | 3744kb | C++ | 753b | 2022-09-01 23:00:01 | 2022-09-01 23:00:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100010;
ll a[N];
bool check(ll x)
{
ll i;
for(i = 2; i * i <= x; i ++)
if(x % i == 0)
return false;
return true;
}
int main()
{
int n;
int i, j;
ll sum;
scanf("%d", &n);
for(i = 0; i < n; i ++)
scanf("%lld", &a[i]);
if(n > 3)
{
puts("Yes");
return 0;
}
for(i = 1; i < (1 << n); i ++)
{
for(j = sum = 0; j < n; j ++)
if(i & (1 << j))
sum += a[j];
if(!check(sum))
{
puts("Yes");
return 0;
}
}
puts("NO");
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
2 5 7
output:
Yes
result:
ok "Yes"
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3744kb
input:
1 97
output:
NO
result:
wrong answer 1st words differ - expected: 'No', found: 'NO'