結果

問題 No.1312 Snake Eyes
ユーザー 👑 H20H20
提出日時 2020-12-09 23:14:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 1,391 ms
コンパイル使用メモリ 81,340 KB
実行使用メモリ 75,392 KB
最終ジャッジ日時 2023-10-19 09:36:01
合計ジャッジ時間 9,804 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,412 KB
testcase_01 WA -
testcase_02 AC 40 ms
53,412 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 40 ms
53,412 KB
testcase_06 AC 39 ms
53,412 KB
testcase_07 AC 40 ms
53,412 KB
testcase_08 AC 40 ms
53,412 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 39 ms
53,412 KB
testcase_12 AC 40 ms
53,412 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 39 ms
53,412 KB
testcase_16 AC 40 ms
53,412 KB
testcase_17 AC 39 ms
53,412 KB
testcase_18 AC 39 ms
53,412 KB
testcase_19 AC 40 ms
53,412 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 40 ms
53,412 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 42 ms
53,412 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 39 ms
53,412 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 49 ms
61,708 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 45 ms
61,208 KB
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 WA -
testcase_64 AC 65 ms
74,952 KB
testcase_65 AC 51 ms
65,812 KB
testcase_66 WA -
testcase_67 WA -
testcase_68 AC 50 ms
65,812 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 AC 77 ms
75,072 KB
testcase_73 WA -
testcase_74 WA -
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 #

N = int(input())

#約数
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


#めぐる式二部探索
#参考サイト:https://aotamasaki.hatenablog.com/entry/meguru_bisect

def is_ok(arg,tar,n):
    # 整数を買えればTrueを返す
    return (arg**n-1)//(arg-1) <= tar

def meguru_bisect(ng, ok, tar, n):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid,tar,n):
            ok = mid
        else:
            ng = mid
    return ok

L=make_divisors(N)
ans = N-1

for l in L:
    for i in range(2,41):
        temp = meguru_bisect(N + 1, 1 ,l ,i)
        if temp==1:
            break 
        if (temp**i)//(temp-1)==l:
            ans = min(temp,ans)

print(ans)
0