QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293012#1842. MathrootcucuWA 3ms7516kbC++17625b2023-12-28 19:47:452023-12-28 19:47:45

Judging History

你现在查看的是最新测评结果

  • [2023-12-28 19:47:45]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:7516kb
  • [2023-12-28 19:47:45]
  • 提交

answer

#include <iostream>
using namespace std;
using ll = long long;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0);
    int a[1'000'005]{0};
    int n; cin >> n;
    for (int i = 0; i < n; i++){
        int v; cin >> v;
        a[v] = 1;
    }
    int ans = 0;
    for (int i = 1; i <= 1'000'000; i++){
        if (a[i] == 0 || (i%2 == 0 && i % 4 > 0))
            continue;
        int j = i;
        for (int d = 2 - j%2; d*d < j; d+=2){
            if (j % d)
                continue;
            int d2 = j / d;
            ans += a[(d2-d)/2];
        }
    }
    cout << ans << "\n";
}


詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 7356kb

input:

5
1 2 3 4 5

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

1
1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 7348kb

input:

5
6 4 7 3 5

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 7516kb

input:

50
89 2 3 86 81 59 29 26 28 8 48 5 6 95 54 91 17 83 4 36 15 43 92 70 30 37 23 96 39 80 9 90 49 82 33 71 61 38 99 50 65 47 78 45 68 7 25 42 13 57

output:

32

result:

wrong answer 1st numbers differ - expected: '29', found: '32'