QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#59285 | #1842. Math | linak | WA | 208ms | 40780kb | Java11 | 677b | 2022-10-28 22:37:01 | 2022-10-28 22:37:02 |
Judging History
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; (2*i+1)*(j/i)<=1000000; j+=i){
p+=k[j]&k[(2*i+1)*(j/i)];
}
}
System.out.println(p);
}
}
详细
Test #1:
score: 100
Accepted
time: 208ms
memory: 40764kb
input:
5 1 2 3 4 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 179ms
memory: 40580kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 204ms
memory: 40716kb
input:
5 6 4 7 3 5
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: -100
Wrong Answer
time: 189ms
memory: 40780kb
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:
41
result:
wrong answer 1st numbers differ - expected: '29', found: '41'