QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#705285#1842. MathVermeilWA 27ms3624kbC++17755b2024-11-02 22:47:502024-11-02 22:47:57

Judging History

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

  • [2024-11-02 22:47:57]
  • 评测
  • 测评结果:WA
  • 用时:27ms
  • 内存:3624kb
  • [2024-11-02 22:47:50]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;


const int MAX = 2020202;
bool v[MAX + 1];
bool f(ll x){
    if (x <= 0) return false;
    if (x > MAX) return false;
    return v[x];
}


signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n;cin>>n;
    for (int i=0;i<n;i++){
        int x;cin>>x;
        v[x] = true;
    }
    ll ans = 0;
    for (ll i=1;i<=MAX;i++){
        for (ll j=i*2;j<=MAX;j+=i){
            if ((j - i) & 1) continue;
            if (f(i * j) && f((j - i) / 2)) ans++;
        }
    }
    cout<<ans;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 26ms
memory: 3620kb

input:

5
1 2 3 4 5

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 26ms
memory: 3504kb

input:

1
1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 26ms
memory: 3508kb

input:

5
6 4 7 3 5

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: -100
Wrong Answer
time: 27ms
memory: 3624kb

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:

20

result:

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