QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#100225 | #5676. Counting Pythagorean Triples | Nicolas125841 | Compile Error | / | / | C++14 | 867b | 2023-04-25 01:08:15 | 2023-04-25 01:12:17 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-04-25 01:12:17]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-04-25 01:08:15]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
int one = 0, two = 0, three = 0, four = 0;
for(ll i = 1; i < n; i++){
for(ll j = i; j < n; j++){
if(i*i + j*j == n*n){
if(gcd(i, j) == 1 && gcd(i, n) == 1 && gcd(j, n) == 1)
one++;
else
two++;
}
}
}
ll v = 1;
while(2*v + 1 <= n*n){
//cout << v << "\n";
if((ll)pow((ll)sqrt(v*v+n*n), 2) == v*v+n*n){
if(gcd(v, n) == 1 && gcd((ll)sqrt(v*v+n*n), n) == 1 && gcd((ll)sqrt(v*v+n*n), v) == 1)
three++;
else
four++;
}
v++;
}
cout << one << " " << two << " " << three << " " << four << "\n";
}
详细
answer.code: In function ‘int main()’: answer.code:17:20: error: ‘gcd’ was not declared in this scope 17 | if(gcd(i, j) == 1 && gcd(i, n) == 1 && gcd(j, n) == 1) | ^~~ answer.code:31:16: error: ‘gcd’ was not declared in this scope 31 | if(gcd(v, n) == 1 && gcd((ll)sqrt(v*v+n*n), n) == 1 && gcd((ll)sqrt(v*v+n*n), v) == 1) | ^~~