結果

問題 No.1312 Snake Eyes
ユーザー H3PO4H3PO4
提出日時 2020-12-09 09:05:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 79,988 KB
最終ジャッジ日時 2023-10-19 04:45:14
合計ジャッジ時間 9,979 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,460 KB
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 39 ms
53,460 KB
testcase_14 WA -
testcase_15 AC 40 ms
53,460 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 WA -
testcase_18 AC 39 ms
53,460 KB
testcase_19 WA -
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 40 ms
53,460 KB
testcase_22 AC 39 ms
53,460 KB
testcase_23 AC 69 ms
74,952 KB
testcase_24 AC 51 ms
65,736 KB
testcase_25 AC 41 ms
55,536 KB
testcase_26 AC 45 ms
61,628 KB
testcase_27 AC 41 ms
55,536 KB
testcase_28 AC 52 ms
67,800 KB
testcase_29 AC 39 ms
53,488 KB
testcase_30 AC 61 ms
74,940 KB
testcase_31 AC 61 ms
73,076 KB
testcase_32 AC 50 ms
65,756 KB
testcase_33 AC 39 ms
53,488 KB
testcase_34 AC 51 ms
67,784 KB
testcase_35 AC 40 ms
55,536 KB
testcase_36 AC 54 ms
71,896 KB
testcase_37 AC 54 ms
69,848 KB
testcase_38 AC 82 ms
75,068 KB
testcase_39 AC 63 ms
75,032 KB
testcase_40 AC 45 ms
61,472 KB
testcase_41 AC 78 ms
75,068 KB
testcase_42 AC 46 ms
61,748 KB
testcase_43 AC 54 ms
69,976 KB
testcase_44 AC 53 ms
69,976 KB
testcase_45 AC 46 ms
61,472 KB
testcase_46 AC 55 ms
72,024 KB
testcase_47 AC 43 ms
57,368 KB
testcase_48 AC 209 ms
75,196 KB
testcase_49 AC 116 ms
75,316 KB
testcase_50 AC 80 ms
75,052 KB
testcase_51 AC 76 ms
75,104 KB
testcase_52 AC 78 ms
75,140 KB
testcase_53 AC 98 ms
75,156 KB
testcase_54 AC 83 ms
75,048 KB
testcase_55 AC 68 ms
75,032 KB
testcase_56 AC 151 ms
75,172 KB
testcase_57 AC 70 ms
75,020 KB
testcase_58 AC 102 ms
75,088 KB
testcase_59 AC 97 ms
75,164 KB
testcase_60 AC 57 ms
65,864 KB
testcase_61 AC 100 ms
75,160 KB
testcase_62 AC 90 ms
75,144 KB
testcase_63 AC 54 ms
68,060 KB
testcase_64 WA -
testcase_65 WA -
testcase_66 AC 66 ms
75,084 KB
testcase_67 AC 47 ms
61,632 KB
testcase_68 AC 51 ms
63,960 KB
testcase_69 AC 53 ms
69,968 KB
testcase_70 AC 123 ms
75,224 KB
testcase_71 AC 87 ms
75,068 KB
testcase_72 WA -
testcase_73 AC 55 ms
70,108 KB
testcase_74 AC 46 ms
63,676 KB
testcase_75 WA -
testcase_76 TLE -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

N = int(input())

ans = N - 1
for i in range(2, isqrt(N) + 1):
    if N % i or i ** 2 == N:
        continue
    div = N // i
    for x in range(1, 50):
        # bisect
        l, r = 1, div
        while r - l > 1:
            m = (r + l) // 2
            if (m ** x - 1) < div * (m - 1):
                l = m
            else:
                r = m
        if (r ** x - 1) == div * (r - 1):
            ans = min(ans, r)
            # print(f'div={div}, x={x}, p={r}')
print(ans)
0