結果

問題 No.617 Nafmo、買い出しに行く
ユーザー tsuji1tsuji1
提出日時 2021-08-14 02:29:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 533 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 76,580 KB
最終ジャッジ日時 2024-04-15 00:06:00
合計ジャッジ時間 7,063 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
62,480 KB
testcase_01 AC 37 ms
52,748 KB
testcase_02 AC 50 ms
65,156 KB
testcase_03 AC 81 ms
75,940 KB
testcase_04 AC 37 ms
53,248 KB
testcase_05 AC 99 ms
75,928 KB
testcase_06 AC 488 ms
75,880 KB
testcase_07 AC 495 ms
75,796 KB
testcase_08 AC 38 ms
52,532 KB
testcase_09 AC 38 ms
53,424 KB
testcase_10 AC 505 ms
75,932 KB
testcase_11 AC 494 ms
75,852 KB
testcase_12 AC 509 ms
75,880 KB
testcase_13 AC 497 ms
75,936 KB
testcase_14 AC 505 ms
76,460 KB
testcase_15 AC 497 ms
75,972 KB
testcase_16 AC 386 ms
76,580 KB
testcase_17 AC 533 ms
76,220 KB
testcase_18 AC 37 ms
53,008 KB
testcase_19 AC 36 ms
52,200 KB
testcase_20 AC 37 ms
52,216 KB
testcase_21 AC 37 ms
52,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[]
for k in range(N):
  A.append(int(input()))
Max=0
for i in range(2**N):

  B=[]
  for j in range(N):
      if (i>>j)&1:
        B.append(A[j])
      else:
        continue;
      
  Sum=sum(B)
  if Sum<=K and Max<Sum:
    Max=Sum
print(Max)
0