結果

問題 No.3358 逆数の小数部分
コンテスト
ユーザー ゼット
提出日時 2025-11-14 21:50:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 427 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 82,636 KB
実行使用メモリ 99,904 KB
最終ジャッジ日時 2025-11-14 21:50:43
合計ジャッジ時間 3,979 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 TLE * 1 -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
ans=False
pos=-1
for i in range(len(S)):
  if S[i]=='.':
    pos=i
    ans=True
    break
if ans==False:
  N=int(S)
  if N==1:
    print(1)
  else:
    print(2)
  exit()
y=S[pos+1:]
y=y+'0'*(100-len(y))
while y[0]=='0':
  y=y[1:]
count=2
if pos==1 and S[0]=='0':
  count=0
z=10**100
y=int(y)
while True:
  count+=1
  if z%y==0:
    print(count)
    exit()
  y,z=z-y,y
  if count>=10**6:
    print('infty')
    exit()
0