結果

問題 No.1464 Number Conversion
ユーザー rodearodea
提出日時 2021-04-09 15:40:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 53,712 KB
最終ジャッジ日時 2024-06-24 22:27:54
合計ジャッジ時間 2,491 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

x = input()

if not '.' in x:
    print(x + '/1')
    exit()

p = x.find('.')
h = x[:p]
t = x[p + 1:]
num = int(h + t)
den = 10 ** len(t)
g = math.gcd(num, den)
num //= g
den //= g

print(str(num) + '/' + str(den))
0