結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-08-19 14:00:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 376 bytes |
| コンパイル時間 | 174 ms |
| コンパイル使用メモリ | 82,640 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-11-29 07:15:09 |
| 合計ジャッジ時間 | 2,587 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 1 |
ソースコード
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)
rlangevin