結果

問題 No.617 Nafmo、買い出しに行く
ユーザー fumofumofunifumofumofuni
提出日時 2023-06-21 00:53:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 414 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 76,984 KB
最終ジャッジ日時 2023-09-10 20:32:34
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,344 KB
testcase_01 AC 72 ms
71,332 KB
testcase_02 AC 79 ms
76,520 KB
testcase_03 AC 94 ms
76,232 KB
testcase_04 AC 73 ms
71,572 KB
testcase_05 AC 101 ms
76,480 KB
testcase_06 AC 394 ms
76,932 KB
testcase_07 AC 390 ms
76,944 KB
testcase_08 AC 71 ms
71,484 KB
testcase_09 AC 72 ms
71,256 KB
testcase_10 AC 392 ms
76,872 KB
testcase_11 AC 387 ms
76,892 KB
testcase_12 AC 395 ms
76,956 KB
testcase_13 AC 387 ms
76,860 KB
testcase_14 AC 394 ms
76,752 KB
testcase_15 AC 411 ms
76,740 KB
testcase_16 AC 250 ms
76,984 KB
testcase_17 AC 414 ms
76,896 KB
testcase_18 AC 71 ms
71,336 KB
testcase_19 AC 73 ms
71,328 KB
testcase_20 AC 71 ms
71,436 KB
testcase_21 AC 73 ms
71,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)

ans=0
for bit in range(2**N):
    ret=0
    for i in range(N):
        if bit>>i&1:
            ret+=A[i]
    if ret<=K:
        ans=max(ans,ret)

print(ans) 

0