結果

問題 No.25 有限小数
ユーザー rlangevinrlangevin
提出日時 2023-08-19 14:00:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 71,496 KB
最終ジャッジ日時 2023-08-19 14:00:45
合計ジャッジ時間 4,372 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,332 KB
testcase_01 AC 62 ms
71,220 KB
testcase_02 AC 62 ms
71,224 KB
testcase_03 AC 63 ms
71,100 KB
testcase_04 AC 74 ms
71,156 KB
testcase_05 AC 66 ms
71,036 KB
testcase_06 AC 63 ms
71,092 KB
testcase_07 AC 65 ms
71,172 KB
testcase_08 AC 63 ms
71,080 KB
testcase_09 AC 62 ms
71,032 KB
testcase_10 AC 81 ms
71,328 KB
testcase_11 AC 63 ms
71,100 KB
testcase_12 AC 61 ms
71,256 KB
testcase_13 AC 60 ms
71,108 KB
testcase_14 AC 61 ms
71,460 KB
testcase_15 AC 62 ms
71,404 KB
testcase_16 AC 63 ms
71,188 KB
testcase_17 AC 64 ms
71,200 KB
testcase_18 AC 62 ms
71,152 KB
testcase_19 AC 65 ms
71,416 KB
testcase_20 AC 67 ms
71,120 KB
testcase_21 AC 66 ms
71,036 KB
testcase_22 WA -
testcase_23 AC 65 ms
71,380 KB
testcase_24 AC 63 ms
71,284 KB
testcase_25 AC 85 ms
71,096 KB
testcase_26 AC 63 ms
71,272 KB
testcase_27 AC 63 ms
71,376 KB
testcase_28 AC 67 ms
71,456 KB
testcase_29 AC 62 ms
71,252 KB
testcase_30 AC 61 ms
71,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())
two, five = 0, 0
while N % 2 == 0:
    N //= 2
    two += 1
while N % 5 == 0:
    N //= 5
    five += 1
while M % 2 == 0:
    M //= 2
    five += 1
while M % 5 == 0:
    M //= 5
    two += 1
    
two, five = two - min(two, five), five - min(two, five)
ans = N % 10 * pow(2, two, 10) * pow(5, five, 10) % 10
print(ans) if M == 1 else print(-1)
0