結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
661nosyamuzuki
|
| 提出日時 | 2019-03-17 22:39:01 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 361 bytes |
| 記録 | |
| コンパイル時間 | 516 ms |
| コンパイル使用メモリ | 50,432 KB |
| 実行使用メモリ | 9,728 KB |
| 最終ジャッジ日時 | 2026-03-29 16:29:40 |
| 合計ジャッジ時間 | 8,655 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 1 -- * 19 |
ソースコード
#include<stdio.h>
#include<math.h>
int main(){
int n,x=1,y=1,z=1,w,d,ans=0;
scanf("%d%d",&n,&d);
for(x=1;x<=n;x++){
for(y=x;y<=n;y++){
for(z=y;z<=n;z++){
for(w=1;w<=n;w++){
if(x*x+y*y+z*z==w*w+d){
if(x==y&&y==z)ans++;
else if(x==y||y==z||z==x)ans+=3;
else ans+=6;
}
}
}
}
}
printf("%d\n",ans);
return 0;
}
661nosyamuzuki