結果

問題 No.1464 Number Conversion
ユーザー KudeKude
提出日時 2021-04-02 21:47:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 998 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 71,668 KB
最終ジャッジ日時 2023-08-25 11:58:23
合計ジャッジ時間 4,385 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,204 KB
testcase_01 AC 68 ms
71,456 KB
testcase_02 AC 68 ms
71,436 KB
testcase_03 AC 66 ms
71,572 KB
testcase_04 AC 67 ms
71,332 KB
testcase_05 AC 70 ms
71,300 KB
testcase_06 AC 67 ms
71,196 KB
testcase_07 AC 70 ms
71,276 KB
testcase_08 AC 68 ms
71,668 KB
testcase_09 AC 70 ms
71,528 KB
testcase_10 AC 69 ms
71,532 KB
testcase_11 AC 71 ms
71,456 KB
testcase_12 AC 69 ms
71,544 KB
testcase_13 AC 69 ms
71,452 KB
testcase_14 AC 69 ms
71,640 KB
testcase_15 AC 67 ms
71,436 KB
testcase_16 AC 68 ms
71,548 KB
testcase_17 AC 67 ms
71,416 KB
testcase_18 AC 65 ms
71,412 KB
testcase_19 AC 65 ms
71,408 KB
testcase_20 AC 65 ms
71,464 KB
testcase_21 AC 67 ms
71,612 KB
testcase_22 AC 65 ms
71,560 KB
testcase_23 AC 66 ms
71,456 KB
testcase_24 AC 67 ms
71,216 KB
testcase_25 AC 67 ms
71,300 KB
testcase_26 AC 65 ms
71,408 KB
testcase_27 AC 67 ms
71,332 KB
testcase_28 AC 64 ms
71,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x = input()
n = len(x)
p = x.find('.')
if p == -1:
    print(x + '/1')
    exit()
c2 = c5 = n - p - 1
x = int(x.replace('.', ''))
while x % 2 == 0 and c2:
    c2 -= 1
    x //= 2
while x % 5 == 0 and c5:
    c5 -= 1
    x //= 5
print(f'{x}/{2 ** c2 * 5 ** c5}')
0