結果

問題 No.1312 Snake Eyes
ユーザー Kiri8128Kiri8128
提出日時 2020-12-09 00:12:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 77,224 KB
最終ジャッジ日時 2023-08-20 11:07:24
合計ジャッジ時間 14,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,252 KB
testcase_01 AC 77 ms
71,508 KB
testcase_02 AC 76 ms
71,296 KB
testcase_03 AC 75 ms
71,304 KB
testcase_04 AC 77 ms
71,524 KB
testcase_05 AC 77 ms
71,336 KB
testcase_06 AC 75 ms
71,288 KB
testcase_07 AC 75 ms
71,288 KB
testcase_08 AC 76 ms
71,296 KB
testcase_09 AC 74 ms
71,332 KB
testcase_10 AC 74 ms
71,332 KB
testcase_11 AC 74 ms
71,560 KB
testcase_12 AC 74 ms
71,308 KB
testcase_13 AC 76 ms
71,348 KB
testcase_14 AC 73 ms
71,204 KB
testcase_15 AC 75 ms
71,300 KB
testcase_16 AC 76 ms
71,292 KB
testcase_17 AC 75 ms
71,356 KB
testcase_18 AC 76 ms
71,272 KB
testcase_19 AC 76 ms
71,352 KB
testcase_20 AC 74 ms
71,424 KB
testcase_21 AC 76 ms
71,340 KB
testcase_22 AC 82 ms
76,108 KB
testcase_23 AC 82 ms
75,872 KB
testcase_24 AC 80 ms
76,092 KB
testcase_25 AC 82 ms
75,884 KB
testcase_26 AC 82 ms
76,088 KB
testcase_27 AC 97 ms
75,840 KB
testcase_28 AC 76 ms
71,364 KB
testcase_29 AC 82 ms
76,000 KB
testcase_30 AC 81 ms
76,020 KB
testcase_31 AC 82 ms
75,776 KB
testcase_32 AC 81 ms
76,064 KB
testcase_33 AC 88 ms
75,844 KB
testcase_34 AC 80 ms
75,992 KB
testcase_35 AC 89 ms
76,004 KB
testcase_36 AC 79 ms
75,864 KB
testcase_37 AC 83 ms
75,900 KB
testcase_38 AC 81 ms
76,060 KB
testcase_39 AC 156 ms
76,536 KB
testcase_40 AC 95 ms
75,848 KB
testcase_41 AC 150 ms
76,364 KB
testcase_42 AC 154 ms
76,400 KB
testcase_43 AC 150 ms
76,516 KB
testcase_44 AC 154 ms
76,092 KB
testcase_45 AC 101 ms
75,776 KB
testcase_46 AC 155 ms
76,588 KB
testcase_47 AC 151 ms
76,824 KB
testcase_48 AC 190 ms
76,544 KB
testcase_49 AC 189 ms
77,004 KB
testcase_50 AC 181 ms
76,872 KB
testcase_51 AC 164 ms
76,872 KB
testcase_52 AC 204 ms
77,056 KB
testcase_53 AC 187 ms
77,064 KB
testcase_54 AC 201 ms
76,952 KB
testcase_55 AC 170 ms
76,956 KB
testcase_56 AC 154 ms
76,472 KB
testcase_57 AC 176 ms
77,056 KB
testcase_58 AC 188 ms
77,204 KB
testcase_59 AC 120 ms
76,572 KB
testcase_60 AC 178 ms
76,956 KB
testcase_61 AC 199 ms
76,968 KB
testcase_62 AC 132 ms
76,536 KB
testcase_63 AC 83 ms
75,772 KB
testcase_64 AC 75 ms
71,356 KB
testcase_65 AC 76 ms
71,368 KB
testcase_66 AC 79 ms
75,836 KB
testcase_67 AC 75 ms
71,444 KB
testcase_68 AC 75 ms
71,148 KB
testcase_69 AC 76 ms
71,484 KB
testcase_70 AC 75 ms
71,356 KB
testcase_71 AC 76 ms
71,272 KB
testcase_72 AC 77 ms
71,172 KB
testcase_73 AC 75 ms
71,468 KB
testcase_74 AC 75 ms
71,368 KB
testcase_75 AC 76 ms
71,240 KB
testcase_76 AC 197 ms
76,540 KB
testcase_77 AC 209 ms
77,224 KB
testcase_78 AC 200 ms
76,548 KB
testcase_79 AC 75 ms
71,168 KB
testcase_80 AC 200 ms
76,432 KB
testcase_81 AC 165 ms
76,620 KB
testcase_82 AC 83 ms
76,316 KB
testcase_83 AC 199 ms
76,884 KB
testcase_84 AC 206 ms
77,056 KB
testcase_85 AC 76 ms
71,492 KB
testcase_86 AC 79 ms
71,272 KB
testcase_87 AC 177 ms
77,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def primeFactor(N):
    i, n, ret, d, sq = 2, N, {}, 2, 99
    while i <= sq:
        k = 0
        while n % i == 0: n, k, ret[i] = n//i, k+1, k+1
        if k > 0 or i == 97: sq = int(n**(1/2)+0.5)
        if i < 4: i = i * 2 - 1
        else: i, d = i+d, d^6
    if n > 1: ret[n] = 1
    return ret
def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)

N = int(input())
for p in range(2, 10 ** 6 + 10):
    s = 0
    a = 1
    f = 0
    while s < N:
        s += a
        a *= p
        if N % s == 0 and N // s < p:
            f = 1
            break
    if f:
        print(p)
        break
else:
    for d in divisors(N):
        a = N // d
        if a < d - 1:
            print(d - 1)
            break
0