QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#697150 | #1842. Math | ship2077 | WA | 7ms | 3956kb | C++14 | 465b | 2024-11-01 11:22:04 | 2024-11-01 11:22:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int m=1e6,M=1e6+5;
int n,buc[M];long long ans;
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
int main(){ n=read();
for (int i=1;i<=n;i++) buc[read()]++;
for (int i=1;i<=m;i++)
for (int j=i&1?1:2,limit=min(i-1,m/i);j<=limit;j+=2)
ans+=1ll*buc[i*j]*buc[i+j>>1];
printf("%lld\n",ans);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 7ms
memory: 3828kb
input:
5 1 2 3 4 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 6ms
memory: 3812kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: -100
Wrong Answer
time: 6ms
memory: 3956kb
input:
5 6 4 7 3 5
output:
2
result:
wrong answer 1st numbers differ - expected: '1', found: '2'