結果
問題 | No.25 有限小数 |
ユーザー |
![]() |
提出日時 | 2023-08-19 14:02:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-11-29 07:16:12 |
合計ジャッジ時間 | 2,394 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
N = int(input())M = int(input())two, five = 0, 0while N % 2 == 0:N //= 2two += 1while N % 5 == 0:N //= 5five += 1while M % 2 == 0:M //= 2five += 1while M % 5 == 0:M //= 5two += 1two, five = two - min(two, five), five - min(two, five)if N % M != 0:print(-1)exit()N //= Mans = N % 10 * pow(2, two, 10) * pow(5, five, 10) % 10print(ans)