結果

問題 No.25 有限小数
ユーザー testestesttestestest
提出日時 2015-08-13 04:20:19
言語 C90
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 241 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 23,932 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 11:23:05
合計ジャッジ時間 1,317 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,376 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 1 ms
4,380 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 0 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 0 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:3:1: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
 scanf("%ld%ld",&a,&b);
 ^~~~~
main.c:3:1: warning: incompatible implicit declaration of built-in function ‘scanf’
main.c:3:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:1:1:
+#include <stdio.h>
 int main(){
main.c:3:1:
 scanf("%ld%ld",&a,&b);
 ^~~~~
main.c:4:34: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
 if(a%b<1){for(a/=b;a%10<1;a/=10);printf("%d",a%10);return 0;}
                                  ^~~~~~
main.c:4:34: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:4:34: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:7:10: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration]
 if(b%2<1)puts("5");else{for(a%=10;b%5<1;a*=2)b/=5;printf("%d",b-1?-1:a%10);}
          ^~~~
main.c:7:51: warning: incompatible implicit declaration of built-in function ‘printf’
 if(b%2<1)puts("5");else{for(a%=10;b%5<1;a*=2)b/=5;printf("%d",b-1?-1:a%10);}
                                                   ^~~~~~
main.c:7:51: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

int main(){
long a,b,p,q,t;
scanf("%ld%ld",&a,&b);
if(a%b<1){for(a/=b;a%10<1;a/=10);printf("%d",a%10);return 0;}
for(p=a,q=b;q;q=t)t=p%q,p=q;
a/=p;b/=p;
if(b%2<1)puts("5");else{for(a%=10;b%5<1;a*=2)b/=5;printf("%d",b-1?-1:a%10);}
return 0;
}
0