結果

問題 No.617 Nafmo、買い出しに行く
ユーザー akitsugu777akitsugu777
提出日時 2019-12-03 13:08:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,014 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 81,648 KB
最終ジャッジ日時 2023-08-18 02:09:30
合計ジャッジ時間 10,389 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,268 KB
testcase_01 AC 16 ms
8,116 KB
testcase_02 AC 17 ms
8,352 KB
testcase_03 AC 73 ms
13,732 KB
testcase_04 AC 16 ms
8,268 KB
testcase_05 AC 135 ms
18,520 KB
testcase_06 AC 1,005 ms
81,616 KB
testcase_07 AC 1,000 ms
81,580 KB
testcase_08 AC 15 ms
8,096 KB
testcase_09 AC 16 ms
8,168 KB
testcase_10 AC 1,000 ms
81,536 KB
testcase_11 AC 1,008 ms
81,612 KB
testcase_12 AC 1,014 ms
81,648 KB
testcase_13 AC 932 ms
80,396 KB
testcase_14 AC 998 ms
81,556 KB
testcase_15 AC 568 ms
56,076 KB
testcase_16 AC 567 ms
56,120 KB
testcase_17 AC 579 ms
56,076 KB
testcase_18 AC 16 ms
8,164 KB
testcase_19 AC 16 ms
8,100 KB
testcase_20 AC 15 ms
8,084 KB
testcase_21 AC 16 ms
8,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

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

print(max(L3))
0