結果

問題 No.617 Nafmo、買い出しに行く
ユーザー osrgy01osrgy01
提出日時 2021-05-24 13:18:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 397 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-04-20 22:56:46
合計ジャッジ時間 5,357 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
58,880 KB
testcase_01 AC 43 ms
52,224 KB
testcase_02 AC 52 ms
60,288 KB
testcase_03 AC 70 ms
62,848 KB
testcase_04 AC 43 ms
52,224 KB
testcase_05 AC 75 ms
66,176 KB
testcase_06 AC 372 ms
75,520 KB
testcase_07 AC 368 ms
75,636 KB
testcase_08 AC 43 ms
51,840 KB
testcase_09 AC 44 ms
51,948 KB
testcase_10 AC 374 ms
75,520 KB
testcase_11 AC 370 ms
75,520 KB
testcase_12 AC 374 ms
75,648 KB
testcase_13 AC 370 ms
75,776 KB
testcase_14 AC 374 ms
75,668 KB
testcase_15 AC 397 ms
75,648 KB
testcase_16 AC 236 ms
75,520 KB
testcase_17 AC 388 ms
75,392 KB
testcase_18 AC 44 ms
51,584 KB
testcase_19 AC 45 ms
51,712 KB
testcase_20 AC 44 ms
51,840 KB
testcase_21 AC 45 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
item=[int(input()) for _ in range(n)]
ans=0
for i in range(2**n):
    cnt=0
    for j in range(n):
        if ((i>>j)&1):
            cnt+=item[j]
    if cnt<=k:
        ans=max(ans,cnt)
print(ans)
0