結果

問題 No.376 立方体のN等分 (2)
ユーザー rpy3cpprpy3cpp
提出日時 2016-06-05 10:45:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 799 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 75,972 KB
最終ジャッジ日時 2023-08-06 19:03:45
合計ジャッジ時間 8,682 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,880 KB
testcase_01 AC 71 ms
71,588 KB
testcase_02 AC 85 ms
75,764 KB
testcase_03 AC 75 ms
75,720 KB
testcase_04 AC 799 ms
75,796 KB
testcase_05 AC 71 ms
71,688 KB
testcase_06 AC 70 ms
71,496 KB
testcase_07 AC 68 ms
71,692 KB
testcase_08 AC 85 ms
75,852 KB
testcase_09 AC 76 ms
75,972 KB
testcase_10 AC 74 ms
75,780 KB
testcase_11 AC 258 ms
75,852 KB
testcase_12 AC 74 ms
75,796 KB
testcase_13 AC 232 ms
75,764 KB
testcase_14 AC 301 ms
75,840 KB
testcase_15 AC 205 ms
75,768 KB
testcase_16 AC 72 ms
75,824 KB
testcase_17 AC 73 ms
75,884 KB
testcase_18 AC 223 ms
75,760 KB
testcase_19 AC 73 ms
75,864 KB
testcase_20 AC 272 ms
75,736 KB
testcase_21 AC 74 ms
75,828 KB
testcase_22 AC 74 ms
75,844 KB
testcase_23 AC 71 ms
71,668 KB
testcase_24 AC 75 ms
75,816 KB
testcase_25 AC 82 ms
75,956 KB
testcase_26 AC 73 ms
75,752 KB
testcase_27 AC 347 ms
75,840 KB
testcase_28 AC 74 ms
75,836 KB
testcase_29 AC 510 ms
75,804 KB
testcase_30 AC 73 ms
75,748 KB
testcase_31 AC 202 ms
75,808 KB
testcase_32 AC 73 ms
75,704 KB
testcase_33 AC 73 ms
75,752 KB
testcase_34 AC 154 ms
75,936 KB
testcase_35 AC 426 ms
75,848 KB
testcase_36 AC 232 ms
75,956 KB
testcase_37 AC 231 ms
75,860 KB
testcase_38 AC 451 ms
75,812 KB
testcase_39 AC 90 ms
75,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def solve(N):
    record = N - 1
    max_a = int(N**(1.0/3.0)) + 2
    for a in range(max_a, 0, -1):
        if N % a:
            continue
        bc = N // a
        max_b = int(bc ** 0.5) + 1
        if max_b * 2 + a - 6 > record:
            break
        for b in range(max_b, 0, -1):
            if bc % b:
                continue
            c = bc // b
            score = a + b + c - 3
            if score < record:
                record = score
            break
    return record, N - 1

print(*solve(N))
0