結果

問題 No.152 貯金箱の消失
ユーザー akakimidoriakakimidori
提出日時 2016-12-09 00:37:21
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 27,184 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 02:40:05
合計ジャッジ時間 1,154 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<math.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;m<=(-1.0+sqrt(1+2*L))/2;m++){
    for(n=1+(m&0x01);n<m && n<=L/(2*m)-m;n+=2){
      if(gcd(m,n)==1){
        count=(count+1)%1000003;
      }
    }
  }

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

  return 0;
}
0