結果

問題 No.1339 循環小数
ユーザー persimmon-persimmon
提出日時 2021-02-12 11:33:16
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 311 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 520,484 KB
最終ジャッジ日時 2024-07-19 05:44:01
合計ジャッジ時間 6,353 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 MLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def main(n):
  now=1
  while now<n:now*=10
  d={}
  cnt=1
  while True:
    now%=n
    if now==0:return 1
    if now in d:return cnt-d[now]
    d[now]=cnt
    now*=10
    cnt+=1

if __name__=='__main__':
  t=int(input())
  cases=[int(input()) for _ in range(t)]
  for n in cases:
    ret=main(n)
    print(ret)
0