結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2015-08-31 03:32:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 544 bytes |
| コンパイル時間 | 67 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-07-18 16:03:16 |
| 合計ジャッジ時間 | 1,913 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 31 |
ソースコード
from fractions import gcd
def solve():
N = int(input())
M = int(input())
g = gcd(N, M)
n = N // g
m = M // g
o = m
c2 = c5 = 0
while o % 5 == 0:
o /= 5
c5 += 1
while o % 2 == 0:
o /= 2
c2 += 1
if o != 1:
print(-1)
return
if c2 == c5:
d = 1
elif c2 > c5:
d = 5
else:
c5 -= c2
d = 2 ** c5 % 10
n *= d
while n % 10 == 0:
n //= 10
print(n % 10)
if __name__ == '__main__':
solve()
しらっ亭