結果
問題 | No.25 有限小数 |
ユーザー |
![]() |
提出日時 | 2020-03-13 15:51:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-11-22 05:54:31 |
合計ジャッジ時間 | 2,120 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 31 |
ソースコード
#!/usr/bin/env python3 import sys input = sys.stdin.readline from fractions import gcd n = int(input()) m = int(input()) g = gcd(n, m) n = n // g m = m // g twos = 0; fives = 0 while m % 2 == 0: m //= 2 twos += 1 while m % 5 == 0: m //= 5 fives += 1 if m == 1: if twos > fives: n *= pow(5, twos - fives) else: n *= pow(2, fives - twos) while n % 10 == 0: n //= 10 print(n % 10) else: print(-1)