結果

問題 No.152 貯金箱の消失
ユーザー tonegawatonegawa
提出日時 2020-08-19 14:08:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 360 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 193,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 08:19:25
合計ジャッジ時間 2,871 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 20 ms
5,376 KB
testcase_09 AC 19 ms
5,376 KB
testcase_10 AC 16 ms
5,376 KB
testcase_11 AC 9 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int L; scanf("%d",&L);

	int ans=0;
	for(int m=2;4*m*m<=L;m++){
		for(int n=1;n<m;n++){
			int a=m*m-n*n;
			int b=2*m*n;
			int c=m*m+n*n;
			if(4*(a+b+c)>L) break;
			if(gcd(m,n)==1 && (m-n)%2==1){
				ans++;
			}
		}
	}
	printf("%d\n",ans);

	return 0;
}
0