結果

問題 No.1312 Snake Eyes
ユーザー AEnAEn
提出日時 2022-09-02 15:37:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 75,888 KB
最終ジャッジ日時 2024-04-27 16:43:29
合計ジャッジ時間 8,094 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,356 KB
testcase_01 AC 40 ms
52,432 KB
testcase_02 AC 38 ms
52,888 KB
testcase_03 AC 38 ms
53,096 KB
testcase_04 AC 39 ms
52,188 KB
testcase_05 AC 39 ms
52,644 KB
testcase_06 AC 39 ms
52,880 KB
testcase_07 AC 38 ms
53,204 KB
testcase_08 AC 40 ms
52,156 KB
testcase_09 AC 44 ms
53,076 KB
testcase_10 AC 40 ms
52,308 KB
testcase_11 AC 40 ms
52,888 KB
testcase_12 AC 41 ms
53,096 KB
testcase_13 AC 40 ms
52,484 KB
testcase_14 AC 41 ms
52,944 KB
testcase_15 AC 40 ms
53,532 KB
testcase_16 AC 41 ms
52,968 KB
testcase_17 AC 39 ms
52,636 KB
testcase_18 AC 40 ms
52,560 KB
testcase_19 AC 41 ms
53,224 KB
testcase_20 AC 39 ms
53,320 KB
testcase_21 AC 40 ms
52,156 KB
testcase_22 AC 38 ms
52,644 KB
testcase_23 AC 46 ms
60,572 KB
testcase_24 AC 47 ms
60,180 KB
testcase_25 AC 46 ms
59,936 KB
testcase_26 AC 44 ms
60,528 KB
testcase_27 AC 47 ms
60,780 KB
testcase_28 AC 44 ms
59,832 KB
testcase_29 AC 51 ms
61,804 KB
testcase_30 AC 48 ms
60,948 KB
testcase_31 AC 53 ms
60,872 KB
testcase_32 AC 49 ms
60,816 KB
testcase_33 AC 47 ms
59,400 KB
testcase_34 AC 51 ms
61,552 KB
testcase_35 AC 51 ms
60,872 KB
testcase_36 AC 49 ms
61,672 KB
testcase_37 AC 49 ms
61,096 KB
testcase_38 AC 55 ms
63,324 KB
testcase_39 AC 55 ms
64,480 KB
testcase_40 AC 58 ms
65,272 KB
testcase_41 AC 53 ms
64,628 KB
testcase_42 AC 53 ms
64,460 KB
testcase_43 AC 55 ms
65,360 KB
testcase_44 AC 53 ms
63,408 KB
testcase_45 AC 53 ms
64,208 KB
testcase_46 AC 56 ms
64,100 KB
testcase_47 AC 53 ms
63,840 KB
testcase_48 AC 113 ms
75,488 KB
testcase_49 AC 104 ms
75,712 KB
testcase_50 AC 94 ms
75,572 KB
testcase_51 AC 76 ms
75,632 KB
testcase_52 AC 113 ms
75,664 KB
testcase_53 AC 99 ms
75,516 KB
testcase_54 AC 108 ms
75,644 KB
testcase_55 AC 82 ms
75,888 KB
testcase_56 AC 90 ms
75,836 KB
testcase_57 AC 92 ms
75,500 KB
testcase_58 AC 103 ms
75,680 KB
testcase_59 AC 75 ms
75,584 KB
testcase_60 AC 88 ms
75,428 KB
testcase_61 AC 114 ms
75,580 KB
testcase_62 AC 79 ms
75,632 KB
testcase_63 AC 49 ms
62,160 KB
testcase_64 AC 54 ms
64,636 KB
testcase_65 AC 59 ms
67,972 KB
testcase_66 AC 44 ms
59,100 KB
testcase_67 AC 39 ms
52,316 KB
testcase_68 AC 54 ms
65,020 KB
testcase_69 AC 49 ms
61,384 KB
testcase_70 AC 103 ms
75,636 KB
testcase_71 AC 89 ms
75,552 KB
testcase_72 AC 57 ms
65,900 KB
testcase_73 AC 50 ms
61,944 KB
testcase_74 AC 46 ms
60,520 KB
testcase_75 AC 48 ms
62,396 KB
testcase_76 AC 114 ms
75,396 KB
testcase_77 AC 115 ms
75,600 KB
testcase_78 AC 115 ms
75,516 KB
testcase_79 AC 121 ms
75,556 KB
testcase_80 AC 115 ms
75,660 KB
testcase_81 AC 116 ms
75,576 KB
testcase_82 AC 118 ms
75,724 KB
testcase_83 AC 118 ms
75,812 KB
testcase_84 AC 115 ms
75,680 KB
testcase_85 AC 112 ms
75,372 KB
testcase_86 AC 106 ms
75,464 KB
testcase_87 AC 85 ms
75,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N==1:
    exit(print(2))
if N==2:
    exit(print(3))

res = float('inf')
for i in range(1, N+1):
    if i*i>N:
        break
    if N%i==0:
        if N//i-1>i:
            res = min(res, N//i-1)
for i in range(1, 40):
    f = False
    for j in range(2,N+1):
        sm = 1
        for k in range(i+1):
            sm += pow(j, k+1)
            if sm>N:
                f = True
                break
        else:
            if N%sm == 0 and N//sm<j:
                res = min(res, j)
        if f:
            break
print(res)
0