結果

問題 No.617 Nafmo、買い出しに行く
ユーザー MaboyMaboy
提出日時 2018-03-01 10:29:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 791 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 48,872 KB
最終ジャッジ日時 2023-08-25 17:22:57
合計ジャッジ時間 8,587 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,056 KB
testcase_01 AC 17 ms
8,240 KB
testcase_02 AC 16 ms
8,424 KB
testcase_03 AC 61 ms
13,680 KB
testcase_04 AC 15 ms
8,084 KB
testcase_05 AC 112 ms
20,256 KB
testcase_06 AC 704 ms
34,516 KB
testcase_07 AC 700 ms
34,488 KB
testcase_08 AC 15 ms
8,036 KB
testcase_09 AC 15 ms
8,204 KB
testcase_10 AC 770 ms
48,872 KB
testcase_11 AC 765 ms
46,708 KB
testcase_12 AC 775 ms
42,988 KB
testcase_13 AC 762 ms
41,892 KB
testcase_14 AC 791 ms
48,660 KB
testcase_15 AC 599 ms
34,516 KB
testcase_16 AC 604 ms
34,652 KB
testcase_17 AC 608 ms
34,532 KB
testcase_18 AC 15 ms
8,140 KB
testcase_19 AC 15 ms
8,192 KB
testcase_20 AC 15 ms
8,032 KB
testcase_21 AC 15 ms
8,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
s=set([0])
n,k=map(int,input().split())
a=[int(input()) for i in'.'*n]
for i in range(1,len(a)+1):
  for j in list(itertools.combinations(a,i)):
    w=sum(j)
    if w<=k:s.add(w)
print(max(s))
0