結果

問題 No.800 四平方定理
ユーザー 661nosyamuzuki661nosyamuzuki
提出日時 2019-03-17 22:39:01
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 361 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 32,652 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-22 08:33:31
合計ジャッジ時間 9,360 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
6,976 KB
testcase_01 AC 628 ms
4,376 KB
testcase_02 AC 320 ms
4,380 KB
testcase_03 AC 403 ms
4,380 KB
testcase_04 AC 285 ms
4,380 KB
testcase_05 AC 377 ms
4,376 KB
testcase_06 AC 896 ms
4,376 KB
testcase_07 AC 516 ms
4,380 KB
testcase_08 AC 903 ms
4,376 KB
testcase_09 AC 683 ms
4,380 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0