結果

問題 No.152 貯金箱の消失
ユーザー akakimidoriakakimidori
提出日時 2015-07-28 10:26:30
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 25,024 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-23 04:34:21
合計ジャッジ時間 1,178 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 15 ms
4,380 KB
testcase_09 AC 15 ms
4,376 KB
testcase_10 AC 11 ms
4,384 KB
testcase_11 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

int gcd(int m,int n){
	int r=m%n;
	while(r>0){
		m=n;
		n=r;
		r=m%n;
	}
	return n;
}

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

	L=L/4;
	int m,n;
	int count=0;
	for(m=2;2*m*(m+1)<=L;m++){
		for(n=1;n<m && 2*m*(m+n)<=L;n++){
			if((m-n)%2==1){
				if(gcd(m,n)==1) count=(count+1)%1000003;
			}
		}
	}

	printf("%d\n",count);

	return 0;
}
0