結果

問題 No.617 Nafmo、買い出しに行く
ユーザー akitsugu777akitsugu777
提出日時 2019-12-03 14:11:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 806 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 49,328 KB
最終ジャッジ日時 2023-08-18 03:36:32
合計ジャッジ時間 8,452 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,116 KB
testcase_01 AC 16 ms
8,232 KB
testcase_02 AC 18 ms
8,264 KB
testcase_03 AC 62 ms
10,732 KB
testcase_04 AC 15 ms
8,132 KB
testcase_05 AC 111 ms
13,252 KB
testcase_06 AC 802 ms
49,136 KB
testcase_07 AC 796 ms
49,328 KB
testcase_08 AC 16 ms
8,088 KB
testcase_09 AC 15 ms
8,160 KB
testcase_10 AC 789 ms
49,276 KB
testcase_11 AC 791 ms
49,260 KB
testcase_12 AC 806 ms
48,996 KB
testcase_13 AC 717 ms
41,660 KB
testcase_14 AC 794 ms
48,948 KB
testcase_15 AC 357 ms
8,184 KB
testcase_16 AC 357 ms
8,228 KB
testcase_17 AC 359 ms
8,116 KB
testcase_18 AC 16 ms
8,196 KB
testcase_19 AC 15 ms
8,124 KB
testcase_20 AC 16 ms
8,120 KB
testcase_21 AC 16 ms
8,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, K = map(int, input().split())
L = [int(input()) for _ in range(N)]

L3 = []
for i in range(N+1):
    for k in itertools.combinations(L, i):
        if sum(k) <= K:
            L3 += [sum(k)]

print(max(L3))
0