結果

問題 No.1312 Snake Eyes
ユーザー 👑 KazunKazun
提出日時 2020-12-09 00:27:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 892 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 76,848 KB
最終ジャッジ日時 2023-08-20 11:10:04
合計ジャッジ時間 12,893 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,128 KB
testcase_01 AC 80 ms
71,212 KB
testcase_02 AC 85 ms
71,392 KB
testcase_03 AC 79 ms
71,384 KB
testcase_04 AC 80 ms
71,108 KB
testcase_05 AC 81 ms
71,516 KB
testcase_06 AC 81 ms
71,520 KB
testcase_07 AC 80 ms
71,532 KB
testcase_08 AC 81 ms
71,348 KB
testcase_09 AC 80 ms
71,132 KB
testcase_10 AC 80 ms
71,208 KB
testcase_11 AC 80 ms
71,348 KB
testcase_12 AC 80 ms
71,624 KB
testcase_13 AC 80 ms
71,328 KB
testcase_14 AC 80 ms
71,492 KB
testcase_15 AC 80 ms
71,088 KB
testcase_16 AC 79 ms
71,236 KB
testcase_17 AC 82 ms
71,352 KB
testcase_18 AC 80 ms
71,416 KB
testcase_19 AC 80 ms
71,376 KB
testcase_20 AC 79 ms
71,316 KB
testcase_21 AC 79 ms
71,272 KB
testcase_22 AC 81 ms
71,372 KB
testcase_23 AC 83 ms
75,368 KB
testcase_24 AC 83 ms
75,376 KB
testcase_25 AC 85 ms
75,536 KB
testcase_26 AC 82 ms
75,532 KB
testcase_27 AC 82 ms
75,424 KB
testcase_28 AC 84 ms
75,648 KB
testcase_29 AC 83 ms
75,272 KB
testcase_30 AC 82 ms
75,284 KB
testcase_31 AC 83 ms
75,476 KB
testcase_32 AC 82 ms
75,436 KB
testcase_33 AC 80 ms
71,300 KB
testcase_34 AC 84 ms
75,196 KB
testcase_35 AC 83 ms
75,368 KB
testcase_36 AC 84 ms
75,528 KB
testcase_37 AC 84 ms
75,280 KB
testcase_38 AC 84 ms
75,684 KB
testcase_39 AC 86 ms
75,424 KB
testcase_40 AC 87 ms
75,532 KB
testcase_41 AC 87 ms
75,332 KB
testcase_42 AC 84 ms
75,280 KB
testcase_43 AC 86 ms
75,496 KB
testcase_44 AC 83 ms
75,420 KB
testcase_45 AC 88 ms
75,504 KB
testcase_46 AC 91 ms
75,504 KB
testcase_47 AC 87 ms
75,504 KB
testcase_48 AC 208 ms
76,376 KB
testcase_49 AC 158 ms
75,740 KB
testcase_50 AC 120 ms
75,504 KB
testcase_51 AC 106 ms
75,420 KB
testcase_52 AC 134 ms
75,368 KB
testcase_53 AC 142 ms
75,232 KB
testcase_54 AC 122 ms
75,368 KB
testcase_55 AC 105 ms
75,492 KB
testcase_56 AC 140 ms
76,484 KB
testcase_57 AC 108 ms
75,484 KB
testcase_58 AC 141 ms
75,516 KB
testcase_59 AC 104 ms
75,820 KB
testcase_60 AC 103 ms
75,404 KB
testcase_61 AC 139 ms
75,852 KB
testcase_62 AC 110 ms
75,148 KB
testcase_63 AC 83 ms
75,364 KB
testcase_64 AC 83 ms
75,520 KB
testcase_65 AC 86 ms
75,288 KB
testcase_66 AC 84 ms
75,476 KB
testcase_67 AC 79 ms
71,476 KB
testcase_68 AC 83 ms
75,376 KB
testcase_69 AC 81 ms
75,504 KB
testcase_70 AC 150 ms
76,212 KB
testcase_71 AC 113 ms
75,848 KB
testcase_72 AC 89 ms
75,640 KB
testcase_73 AC 88 ms
75,288 KB
testcase_74 AC 82 ms
75,404 KB
testcase_75 AC 83 ms
75,332 KB
testcase_76 AC 892 ms
76,848 KB
testcase_77 AC 114 ms
75,524 KB
testcase_78 AC 116 ms
75,300 KB
testcase_79 AC 116 ms
76,348 KB
testcase_80 AC 123 ms
76,352 KB
testcase_81 AC 129 ms
75,328 KB
testcase_82 AC 203 ms
76,436 KB
testcase_83 AC 207 ms
76,148 KB
testcase_84 AC 120 ms
75,560 KB
testcase_85 AC 146 ms
76,172 KB
testcase_86 AC 200 ms
76,264 KB
testcase_87 AC 106 ms
75,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#約数全部
def Divisors(N):
    N=abs(N)
    L,U=[],[]
    k=1
    while k*k <=N:
        if N%k== 0:
            L.append(k)
            if k*k!=N:
                U.append(N//k)
        k+=1
    return L+U[::-1]

def check(N,r):
    p=N%r
    while N:
        if N%r!=p:
            return False
        N//=r
    return True
#================================================
N=int(input())

if N<=2:
    print(N+1)
    exit(0)

D=Divisors(N)

X=float("inf")
for a in D:
    M=N//a
    B=Divisors(M-1)

    for p in B:
        if p>=2 and check(N,p):
            X=min(X,p)
print(X)
0