結果

問題 No.617 Nafmo、買い出しに行く
ユーザー iad_2889iad_2889
提出日時 2019-05-16 14:02:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 75,312 KB
最終ジャッジ日時 2023-10-17 06:52:51
合計ジャッジ時間 3,705 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
56,820 KB
testcase_01 AC 38 ms
53,472 KB
testcase_02 AC 48 ms
62,036 KB
testcase_03 AC 63 ms
75,244 KB
testcase_04 AC 39 ms
53,472 KB
testcase_05 AC 72 ms
75,220 KB
testcase_06 AC 215 ms
75,240 KB
testcase_07 AC 211 ms
75,236 KB
testcase_08 AC 38 ms
53,472 KB
testcase_09 AC 38 ms
53,472 KB
testcase_10 AC 216 ms
75,260 KB
testcase_11 AC 216 ms
75,264 KB
testcase_12 AC 214 ms
75,264 KB
testcase_13 AC 218 ms
75,260 KB
testcase_14 AC 218 ms
75,264 KB
testcase_15 AC 212 ms
75,220 KB
testcase_16 AC 219 ms
75,312 KB
testcase_17 AC 218 ms
75,208 KB
testcase_18 AC 38 ms
53,472 KB
testcase_19 AC 39 ms
53,472 KB
testcase_20 AC 38 ms
53,472 KB
testcase_21 AC 38 ms
53,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations as com
N,K = map(int,input().split())
products = [int(input()) for x in range(N)]
max_p = 0
for n in range(1,N + 1):
    for p_set in com(products,n):
        if max_p < sum(p_set) <= K:
            max_p = sum(p_set)
print(max_p)
0