結果

問題 No.3028 No.9999
ユーザー bfs84
提出日時 2025-02-28 20:23:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 706 ms / 4,000 ms
コード長 2,436 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 62,188 KB
最終ジャッジ日時 2025-02-28 20:23:55
合計ジャッジ時間 4,035 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import bisect
import itertools
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify

n = int(input())

cur = 1
for i in range(1, n * 2):
    cur = (cur * 10) % n
    if ((cur - 1) + n) % n == 0:
        print(i)
        exit()


# mathモジュールの説明
# # 基本的な数学関数
# math.ceil(3.7)    # 切り上げ: 4
# math.floor(3.7)   # 切り捨て: 3
# math.trunc(3.7)   # 整数部分: 3
# math.fabs(-3.7)   # 絶対値: 3.7

# # 指数・対数
# math.exp(1)       # e^x
# math.log(x)       # 自然対数
# math.log10(x)     # 常用対数
# math.pow(2, 3)    # 2^3 = 8

# # 三角関数
# math.sin(x)
# math.cos(x)
# math.tan(x)
# math.degrees(x)   # ラジアン→度
# math.radians(x)   # 度→ラジアン

# # 特殊な定数
# math.pi           # π
# math.e            # 自然対数の底

# # その他
# math.gcd(a, b)    # 最大公約数
# math.lcm(a, b)    # 最小公倍数(Python 3.9以降)
# math.factorial(n) # 階乗
# math.sqrt(x)      # 平方根


# bisectモジュールの説明
# # ソート済みリストに対する二分探索
# bisect.bisect_left(a, x)   # x以上の値が最初に現れる位置
# bisect.bisect_right(a, x)  # xより大きい値が最初に現れる位置
# bisect.bisect(a, x)        # bisect_rightと同じ
# bisect.insort_left(a, x)   # ソートを保ったままxを挿入
# bisect.insort_right(a, x)  # ソートを保ったままxを挿入(同値の要素の右に)


# collectionsモジュールの説明
# # defaultdict: 存在しないキーへのアクセスでデフォルト値を返す
# d = defaultdict(int)      # デフォルト値0
# d = defaultdict(list)     # デフォルト値[]
# d = defaultdict(set)      # デフォルト値set()

# # deque: 両端キュー
# d = deque()              # 初期化
# d.append(x)              # 右端に追加
# d.appendleft(x)          # 左端に追加
# d.pop()                  # 右端から取り出し
# d.popleft()              # 左端から取り出し
# d.rotate(n)              # n回右にローテーション


# heapqモジュールの説明
# # 優先度付きキュー(最小ヒープ)
# heappush(heap, item)     # ヒープに要素を追加
# item = heappop(heap)     # 最小値の取り出し
# item = heap[0]           # 最小値の参照(削除なし)
# heapify(list)            # リストをヒープに変換
0