結果

問題 No.3358 逆数の小数部分
コンテスト
ユーザー Tyara-173
提出日時 2025-11-18 15:11:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-11-18 15:11:32
合計ジャッジ時間 2,722 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
a = ''
b = 1
dec = False
for c in s:
    if c == '.':
        dec = True
        continue
    if dec:
        b *= 10
    a += c
a = int(a)
if b == 1:
    print(min(2,a))
    exit()
cnt = 0
while b != 1 and a % b != 0:
    t = a
    a = b
    b = t
    a %= b
    cnt += 1
print(cnt)
0