結果

問題 No.617 Nafmo、買い出しに行く
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-03 08:56:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 527 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 182,728 KB
最終ジャッジ日時 2023-08-14 19:04:31
合計ジャッジ時間 8,035 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
76,284 KB
testcase_01 AC 76 ms
71,084 KB
testcase_02 AC 116 ms
76,596 KB
testcase_03 AC 106 ms
84,516 KB
testcase_04 AC 72 ms
71,148 KB
testcase_05 AC 122 ms
94,724 KB
testcase_06 AC 509 ms
182,564 KB
testcase_07 AC 527 ms
182,512 KB
testcase_08 AC 73 ms
71,340 KB
testcase_09 AC 72 ms
71,220 KB
testcase_10 AC 508 ms
182,268 KB
testcase_11 AC 507 ms
182,728 KB
testcase_12 AC 505 ms
182,536 KB
testcase_13 AC 501 ms
166,780 KB
testcase_14 AC 507 ms
182,244 KB
testcase_15 AC 466 ms
113,692 KB
testcase_16 AC 464 ms
113,584 KB
testcase_17 AC 463 ms
114,116 KB
testcase_18 AC 73 ms
71,268 KB
testcase_19 AC 71 ms
71,224 KB
testcase_20 AC 77 ms
71,236 KB
testcase_21 AC 73 ms
71,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

input_list = list(map(int,input().split()))
n, k = input_list
a_list = [int(input()) for i in range(n)]

res_list = []

for i in range(2 ** n):
    res_e = 0
    for j in range(n):
        if (i >> j) & 1:
            res_e += a_list[j]
    res_list.append(res_e)
    
res = max([e for e in res_list if e <= k])

print(res)
0