QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#59283#1842. MathlinakWA 175ms42900kbJava11667b2022-10-28 22:24:312022-10-28 22:24:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-28 22:24:33]
  • 评测
  • 测评结果:WA
  • 用时:175ms
  • 内存:42900kb
  • [2022-10-28 22:24:31]
  • 提交

answer

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int a = Integer.parseInt(bf.readLine());
        String[] s = bf.readLine().split(" ");
        int[] k=new int[1000001];
        for(int i=0; i<a; i++){
            int x=Integer.parseInt(s[i]);
            k[x]++;
        }
        long p=0;
        for(int i=1; i<=1000000; i++){
            for(int j=i; 2L*i*j+1<=1000000; j++){
                p+=k[i*j]&k[2*i*j+1];
            }
        }
        System.out.println(p);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 166ms
memory: 42132kb

input:

5
1 2 3 4 5

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 164ms
memory: 42900kb

input:

1
1

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 162ms
memory: 42152kb

input:

5
6 4 7 3 5

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: -100
Wrong Answer
time: 175ms
memory: 42460kb

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:

24

result:

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