結果

問題 No.1464 Number Conversion
ユーザー gorugo30gorugo30
提出日時 2021-04-02 21:29:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 71,664 KB
最終ジャッジ日時 2023-08-25 11:28:57
合計ジャッジ時間 3,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,372 KB
testcase_01 AC 66 ms
71,640 KB
testcase_02 AC 67 ms
71,316 KB
testcase_03 AC 69 ms
71,288 KB
testcase_04 AC 67 ms
71,304 KB
testcase_05 AC 69 ms
71,488 KB
testcase_06 AC 69 ms
71,456 KB
testcase_07 AC 68 ms
71,552 KB
testcase_08 AC 67 ms
71,508 KB
testcase_09 AC 67 ms
71,416 KB
testcase_10 AC 68 ms
71,460 KB
testcase_11 AC 68 ms
71,576 KB
testcase_12 AC 67 ms
71,440 KB
testcase_13 AC 67 ms
71,156 KB
testcase_14 AC 68 ms
71,620 KB
testcase_15 AC 69 ms
71,616 KB
testcase_16 AC 70 ms
71,572 KB
testcase_17 AC 68 ms
71,388 KB
testcase_18 AC 67 ms
71,640 KB
testcase_19 AC 67 ms
71,348 KB
testcase_20 AC 68 ms
71,156 KB
testcase_21 AC 69 ms
71,664 KB
testcase_22 AC 67 ms
71,500 KB
testcase_23 AC 66 ms
71,152 KB
testcase_24 AC 67 ms
71,484 KB
testcase_25 AC 68 ms
71,152 KB
testcase_26 AC 69 ms
71,156 KB
testcase_27 AC 67 ms
71,348 KB
testcase_28 AC 66 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = input()
if "." not in X:
    print(X + "/1")
    exit()

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

l = len(X) - X.index(".") - 1
X = X[:X.index(".")] + X[X.index(".") + 1: len(X)]
g = gcd(int(X), 10 ** l)
print(int(X) // g, "/", (10 ** l) // g, sep = "")
0