結果

問題 No.800 四平方定理
ユーザー 661nosyamuzuki661nosyamuzuki
提出日時 2019-03-17 21:48:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 33,636 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-22 05:00:06
合計ジャッジ時間 5,190 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
7,232 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 53 ms
4,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 96 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 267 ms
4,376 KB
testcase_09 AC 79 ms
4,376 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*x+y*y+z*z-d<=n*n&&x<=n;x++){
		for(y=1;x*x+y*y+z*z-d<=n*n&&y<=n;y++){
			for(z=1;x*x+y*y+z*z-d<=n*n&&z<=n;z++){
				int tmp=-d+x*x+y*y+z*z;
				tmp=sqrt(tmp);
				if(x*x+y*y+z*z==tmp*tmp+d){
                  ans++;
          //        printf("%d,%d,%d,%d\n",x,y,z,tmp);
                }
            }
          z=1;
		}
      y=1;
	}
	printf("%d\n",ans);
	return 0;
}
0