結果

問題 No.1312 Snake Eyes
ユーザー ntudantuda
提出日時 2021-12-12 17:05:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 77,620 KB
最終ジャッジ日時 2023-09-28 09:34:13
合計ジャッジ時間 13,860 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,592 KB
testcase_01 AC 74 ms
71,384 KB
testcase_02 AC 75 ms
71,584 KB
testcase_03 AC 79 ms
71,396 KB
testcase_04 AC 75 ms
71,448 KB
testcase_05 AC 76 ms
71,388 KB
testcase_06 AC 74 ms
71,588 KB
testcase_07 AC 75 ms
71,256 KB
testcase_08 AC 74 ms
71,616 KB
testcase_09 AC 75 ms
71,448 KB
testcase_10 AC 75 ms
71,588 KB
testcase_11 AC 74 ms
71,584 KB
testcase_12 AC 74 ms
71,272 KB
testcase_13 AC 75 ms
71,300 KB
testcase_14 AC 76 ms
71,580 KB
testcase_15 AC 74 ms
71,464 KB
testcase_16 AC 73 ms
71,156 KB
testcase_17 AC 76 ms
71,056 KB
testcase_18 AC 75 ms
71,216 KB
testcase_19 AC 76 ms
71,464 KB
testcase_20 AC 75 ms
71,264 KB
testcase_21 AC 76 ms
71,580 KB
testcase_22 AC 74 ms
71,252 KB
testcase_23 AC 80 ms
75,488 KB
testcase_24 AC 78 ms
75,756 KB
testcase_25 AC 76 ms
75,556 KB
testcase_26 AC 77 ms
75,420 KB
testcase_27 WA -
testcase_28 AC 79 ms
75,308 KB
testcase_29 AC 78 ms
75,564 KB
testcase_30 AC 78 ms
75,876 KB
testcase_31 AC 78 ms
75,628 KB
testcase_32 AC 78 ms
75,688 KB
testcase_33 AC 76 ms
71,592 KB
testcase_34 AC 79 ms
75,624 KB
testcase_35 WA -
testcase_36 AC 79 ms
75,432 KB
testcase_37 AC 77 ms
75,488 KB
testcase_38 AC 79 ms
75,448 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 AC 79 ms
75,624 KB
testcase_64 AC 82 ms
75,488 KB
testcase_65 AC 84 ms
75,628 KB
testcase_66 AC 79 ms
75,448 KB
testcase_67 AC 77 ms
71,356 KB
testcase_68 AC 82 ms
75,544 KB
testcase_69 AC 81 ms
75,616 KB
testcase_70 AC 144 ms
76,120 KB
testcase_71 AC 111 ms
75,908 KB
testcase_72 AC 86 ms
75,804 KB
testcase_73 AC 81 ms
75,640 KB
testcase_74 AC 80 ms
75,660 KB
testcase_75 AC 81 ms
75,444 KB
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 AC 113 ms
75,776 KB
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 193 ms
76,492 KB
testcase_83 WA -
testcase_84 WA -
testcase_85 AC 129 ms
75,652 KB
testcase_86 AC 186 ms
76,564 KB
testcase_87 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def make_divisors(n):
    divisors = []
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
        i += 1
    divisors.sort()
    return divisors

N = int(input())
if N == 1:
    print(2)
    sys.exit()
if N == 2:
    print(3)
    sys.exit()
D = make_divisors(N)
D.pop(-1)
ans = 10**5
for a in D:
    n = N // a
    D2 = make_divisors(n-1)
    D2.remove(1)
    flag = 0
    for p in D2:
        if a >= p:
            continue
        tmp = 1
        p2 = 1
        while tmp < n:
            if n - 1 == p * tmp:
                ans = min(p,ans)
                flag = 1
                break
            p2 *= p
            tmp += p2
        if flag == 1:
            break

print(ans)
0