結果

問題 No.375 立方体のN等分 (1)
ユーザー convexineqconvexineq
提出日時 2021-02-22 06:40:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 513 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 66,392 KB
最終ジャッジ日時 2023-10-20 07:58:01
合計ジャッジ時間 3,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,448 KB
testcase_01 AC 36 ms
53,448 KB
testcase_02 AC 49 ms
61,696 KB
testcase_03 AC 36 ms
53,448 KB
testcase_04 AC 36 ms
53,448 KB
testcase_05 AC 36 ms
53,448 KB
testcase_06 AC 39 ms
57,212 KB
testcase_07 AC 39 ms
57,212 KB
testcase_08 AC 54 ms
61,972 KB
testcase_09 AC 39 ms
57,212 KB
testcase_10 AC 43 ms
57,212 KB
testcase_11 AC 40 ms
57,212 KB
testcase_12 AC 42 ms
57,212 KB
testcase_13 AC 41 ms
57,212 KB
testcase_14 AC 59 ms
64,304 KB
testcase_15 AC 42 ms
57,216 KB
testcase_16 AC 42 ms
57,216 KB
testcase_17 AC 74 ms
66,392 KB
testcase_18 AC 58 ms
64,304 KB
testcase_19 AC 42 ms
57,216 KB
testcase_20 AC 42 ms
57,216 KB
testcase_21 AC 42 ms
57,216 KB
testcase_22 AC 83 ms
66,392 KB
testcase_23 AC 42 ms
57,216 KB
testcase_24 AC 42 ms
57,216 KB
testcase_25 AC 49 ms
61,828 KB
testcase_26 AC 43 ms
57,216 KB
testcase_27 AC 42 ms
57,216 KB
testcase_28 AC 43 ms
57,216 KB
testcase_29 AC 42 ms
57,216 KB
testcase_30 AC 42 ms
57,216 KB
testcase_31 AC 42 ms
57,216 KB
testcase_32 AC 42 ms
57,216 KB
testcase_33 AC 42 ms
57,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)

n = int(input())
a = divisor_list(n)
L = len(a)
ans = n
for i in range(L):
    for j in range(i,L):
        if n//a[i]//a[j] < a[j]: break
        if n//a[i]%a[j]: continue
        k = n//a[i]//a[j]
        ans = min(ans,a[i]+a[j]+k-3)
print(ans,n-1)
0