結果
| 問題 | No.1464 Number Conversion |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2021-04-02 21:47:35 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 262 bytes |
| 記録 | |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 84,884 KB |
| 実行使用メモリ | 52,224 KB |
| 最終ジャッジ日時 | 2026-05-29 17:56:13 |
| 合計ジャッジ時間 | 2,393 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
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}')
Kude