結果

問題 No.152 貯金箱の消失
ユーザー akakimidoriakakimidori
提出日時 2015-07-28 10:26:30
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 04:39:29
合計ジャッジ時間 796 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d",&L);
      |         ^~~~~~~~~~~~~~

ソースコード

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