結果

問題 No.617 Nafmo、買い出しに行く
ユーザー ssmkzkssmkzk
提出日時 2018-08-07 18:14:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 642 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 11,880 KB
実行使用メモリ 35,428 KB
最終ジャッジ日時 2023-10-19 22:28:47
合計ジャッジ時間 7,637 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,076 KB
testcase_01 AC 31 ms
10,064 KB
testcase_02 AC 32 ms
10,232 KB
testcase_03 AC 62 ms
12,416 KB
testcase_04 AC 30 ms
10,064 KB
testcase_05 AC 95 ms
14,348 KB
testcase_06 AC 624 ms
35,428 KB
testcase_07 AC 627 ms
35,428 KB
testcase_08 AC 30 ms
10,064 KB
testcase_09 AC 30 ms
10,064 KB
testcase_10 AC 620 ms
35,428 KB
testcase_11 AC 605 ms
35,428 KB
testcase_12 AC 609 ms
35,428 KB
testcase_13 AC 624 ms
35,428 KB
testcase_14 AC 610 ms
35,428 KB
testcase_15 AC 638 ms
35,428 KB
testcase_16 AC 632 ms
35,428 KB
testcase_17 AC 642 ms
35,428 KB
testcase_18 AC 30 ms
10,064 KB
testcase_19 AC 30 ms
10,064 KB
testcase_20 AC 29 ms
10,064 KB
testcase_21 AC 29 ms
10,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N, K = map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))

for i in range(1, N + 1):
    for li in list(itertools.combinations(l,i)):
        if ans < sum(li) <= K:
            ans = sum(li)
print(ans)

0