結果
| 問題 |
No.152 貯金箱の消失
|
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2016-12-09 00:37:21 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 414 bytes |
| コンパイル時間 | 229 ms |
| コンパイル使用メモリ | 24,192 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 03:05:27 |
| 合計ジャッジ時間 | 1,080 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:16:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%d",&L);
| ^~~~~~~~~~~~~~
ソースコード
#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;
}
akakimidori