結果

問題 No.375 立方体のN等分 (1)
ユーザー rlangevinrlangevin
提出日時 2023-02-08 01:18:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 375 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 76,700 KB
最終ジャッジ日時 2023-09-19 05:43:22
合計ジャッジ時間 7,432 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,220 KB
testcase_01 AC 76 ms
71,340 KB
testcase_02 AC 128 ms
76,344 KB
testcase_03 AC 75 ms
71,276 KB
testcase_04 AC 75 ms
71,128 KB
testcase_05 AC 75 ms
71,124 KB
testcase_06 AC 78 ms
75,268 KB
testcase_07 AC 86 ms
75,496 KB
testcase_08 AC 119 ms
76,372 KB
testcase_09 AC 84 ms
75,348 KB
testcase_10 AC 89 ms
75,492 KB
testcase_11 AC 89 ms
75,352 KB
testcase_12 AC 91 ms
75,492 KB
testcase_13 AC 92 ms
75,228 KB
testcase_14 AC 203 ms
76,600 KB
testcase_15 AC 99 ms
75,512 KB
testcase_16 AC 92 ms
75,560 KB
testcase_17 AC 289 ms
76,616 KB
testcase_18 AC 214 ms
76,700 KB
testcase_19 AC 97 ms
75,212 KB
testcase_20 AC 89 ms
75,148 KB
testcase_21 AC 89 ms
75,268 KB
testcase_22 AC 375 ms
76,488 KB
testcase_23 AC 94 ms
75,348 KB
testcase_24 AC 89 ms
75,216 KB
testcase_25 AC 122 ms
76,108 KB
testcase_26 AC 93 ms
75,088 KB
testcase_27 AC 97 ms
75,164 KB
testcase_28 AC 88 ms
75,696 KB
testcase_29 AC 89 ms
75,352 KB
testcase_30 AC 91 ms
75,340 KB
testcase_31 AC 95 ms
75,092 KB
testcase_32 AC 88 ms
75,088 KB
testcase_33 AC 92 ms
75,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    if n <= 0:
        return []
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return list(S)

N = int(input())
minv, maxv = 10 ** 18, 0
for d1 in div(N):
    temp = N // d1
    for d2 in div(temp):
        d3 = temp // d2
        minv = min(minv, d1 + d2 + d3 - 3)
        maxv = max(maxv, d1 + d2 + d3 - 3)

print(minv, maxv)
0