結果

問題 No.1464 Number Conversion
ユーザー wattaiheiwattaihei
提出日時 2021-04-02 21:36:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 71,688 KB
最終ジャッジ日時 2023-08-25 11:40:49
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,240 KB
testcase_01 AC 69 ms
71,304 KB
testcase_02 AC 69 ms
71,184 KB
testcase_03 AC 68 ms
71,644 KB
testcase_04 AC 69 ms
71,472 KB
testcase_05 AC 66 ms
71,300 KB
testcase_06 AC 68 ms
71,352 KB
testcase_07 AC 68 ms
71,488 KB
testcase_08 AC 67 ms
71,564 KB
testcase_09 AC 69 ms
71,304 KB
testcase_10 AC 67 ms
71,688 KB
testcase_11 AC 67 ms
71,304 KB
testcase_12 AC 68 ms
71,584 KB
testcase_13 AC 66 ms
71,164 KB
testcase_14 AC 68 ms
71,536 KB
testcase_15 AC 69 ms
71,188 KB
testcase_16 AC 69 ms
71,368 KB
testcase_17 AC 68 ms
71,684 KB
testcase_18 AC 68 ms
71,252 KB
testcase_19 AC 69 ms
71,188 KB
testcase_20 AC 69 ms
71,448 KB
testcase_21 AC 69 ms
71,300 KB
testcase_22 AC 69 ms
71,524 KB
testcase_23 AC 70 ms
71,332 KB
testcase_24 AC 69 ms
71,408 KB
testcase_25 AC 69 ms
71,524 KB
testcase_26 AC 69 ms
71,448 KB
testcase_27 AC 69 ms
71,588 KB
testcase_28 AC 69 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

S = input()

if S.count("."):
    sa, sb = S.split(".")
    dig = len(sb)
    a = int(sa)
    b = int(sb)

    x = a*10**dig + b 
    y = 10**dig
    g = gcd(x, y)
    x //= g
    y //= g
else:
    x = int(S)
    y = 1

print("{}/{}".format(x, y))
0