結果

問題 No.3028 No.9999
ユーザー kidodesu
提出日時 2025-02-21 21:35:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,768 KB
実行使用メモリ 59,656 KB
最終ジャッジ日時 2025-02-21 21:35:40
合計ジャッジ時間 2,325 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def euler_phi(n):
    res = n
    x = 2
    while x*x <= n:
        if n % x == 0:
            res = res // x * (x-1)
            while n % x == 0:
                n //= x
        x += 1
    if n > 1:
        res = res // n * (n-1)
    return res

n = int(input())
N = n
n = euler_phi(n)
C = set()
for i in range(1, int(n**(1/2))+1):
    if n % i == 0:
        C.add(i)
        C.add(n//i)

C = list(C)
C.sort()
for c in C:
    if pow(10, c, N) == 1:
        print(c)
        exit()
0