結果

問題 No.376 立方体のN等分 (2)
ユーザー rlangevinrlangevin
提出日時 2023-08-04 00:01:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 88,064 KB
最終ジャッジ日時 2024-04-21 22:37:55
合計ジャッジ時間 13,662 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
57,600 KB
testcase_01 AC 46 ms
52,096 KB
testcase_02 AC 683 ms
59,392 KB
testcase_03 AC 1,273 ms
63,872 KB
testcase_04 AC 897 ms
58,880 KB
testcase_05 AC 46 ms
51,968 KB
testcase_06 AC 45 ms
52,224 KB
testcase_07 AC 45 ms
51,968 KB
testcase_08 AC 65 ms
57,088 KB
testcase_09 AC 127 ms
57,216 KB
testcase_10 AC 1,222 ms
75,520 KB
testcase_11 AC 279 ms
57,600 KB
testcase_12 AC 567 ms
59,264 KB
testcase_13 AC 297 ms
56,960 KB
testcase_14 AC 354 ms
57,088 KB
testcase_15 AC 276 ms
57,088 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

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