結果

問題 No.1464 Number Conversion
ユーザー titia
提出日時 2021-04-02 21:37:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-23 18:36:06
合計ジャッジ時間 1,788 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

X=input().strip()

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

t=X.index(".")

S=X[:t]
r=X[t+1:]

SI=int(r)
BO=int("1"+len(r)*"0")

SI+=int(S)*BO

from math import gcd
G=gcd(SI,BO)

print(str(SI//G)+"/"+str(BO//G))
0