backpack problem

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

0/1 backpack problem
This problem deals with putting objects into a backpack.
Input 2 integers: the capacity of the backpack and the list of objects.
Input a series of numbers indicating the capacity of the objects.
The objects can either be chosen or not be chosen.
Output the minimum space left in the backpack.

Options

exec is denied

rejudge feature is enabled

1day(s) and 10:33:49 before deadline (04/22 22:18:37 JST), all source codes will be revealed after the deadline

Sample input:_

20 5
7
5
7
3
7

Sample output:

1

Sample input:_

10 3
4
8
5

Sample output:

1

Sample input:_

90 12
3
7
4
5
13
2
8
4
7
6
5
7

Sample output:

19

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1Histocrat (embed)120.03222019/04/10 04:54:470B / 10B / 1B
2mitchs120.03192019/04/10 04:58:130B / 10B / 1B
3rotary-o120.04002019/04/10 22:04:540B / 10B / 1B
4clock120.05062019/04/20 12:08:420B / 10B / 1B

Ruby2 _

RankUserSizeTimeDateStatistics
1hako140.15652019/04/09 22:17:470B / 9B / 4B
2mitchs140.15232019/04/09 22:44:080B / 9B / 4B
3rotary-o140.15492019/04/09 23:28:530B / 9B / 4B
4Histocrat (embed)140.15072019/04/10 06:37:100B / 9B / 4B
5letranger160.14892019/04/09 19:27:490B / 11B / 4B

Perl _

RankUserSizeTimeDateStatistics
1tails140.06432019/04/09 11:54:170B / 8B / 6B
2mitchs140.03212019/04/09 12:27:550B / 9B / 5B
3morio__150.03212019/04/09 18:36:050B / ?B / ?B

Python _

RankUserSizeTimeDateStatistics
1clock220.06992019/04/09 21:14:340B / 15B / 6B
2mitchs220.07152019/04/09 22:53:140B / 15B / 6B
3mypetlion230.07362019/04/09 05:54:340B / 16B / 6B
4morio__230.07012019/04/09 16:45:180B / ?B / ?B

Python3 _

RankUserSizeTimeDateStatistics
1clock190.12222019/04/09 21:20:080B / 12B / 7B
2mitchs190.11822019/04/09 22:53:560B / 12B / 7B
3mypetlion200.12452019/04/09 04:25:130B / 13B / 7B
4morio__200.11862019/04/09 16:43:580B / ?B / ?B

JavaScript _

RankUserSizeTimeDateStatistics
1FizzyTea240.10792019/04/10 06:00:200B / 16B / 8B

Lua _

RankUserSizeTimeDateStatistics
1clock230.03212019/04/09 22:12:420B / 15B / 8B
2tehtmi (embed)230.03192019/04/10 09:14:150B / 15B / 8B

C _

RankUserSizeTimeDateStatistics
1nu320.03142019/04/10 11:13:150B / 18B / 14B
2tails320.03152019/04/11 21:34:130B / 18B / 14B
3nai320.03142019/04/13 02:09:250B / 18B / 14B

sed _

RankUserSizeTimeDateStatistics
1clock110.03122019/04/09 16:25:120B / 8B / 1B
2tails110.03122019/04/09 18:33:080B / 8B / 1B
3mitchs110.03122019/04/09 19:28:240B / 6B / 3B
4mitchs (alt)110.03122019/04/09 19:32:150B / 8B / 1B

Bash (builtins) _

RankUserSizeTimeDateStatistics
1tails230.03222019/04/09 09:46:180B / 13B / 6B

wake _

RankUserSizeTimeDateStatistics
1clock140.04582019/04/10 01:46:200B / 3B / 10B

dc _

RankUserSizeTimeDateStatistics
1tails80.03582019/04/09 09:07:480B / 4B / 4B
2clock80.03132019/04/10 00:25:130B / 5B / 3B

Brainfuck _

RankUserSizeTimeDateStatistics
1mitchs140.03152019/04/10 08:45:560B / 0B / 14B
2hako230.03162019/04/10 00:52:010B / ?B / ?B
3Unihedron ユニ230.03162019/04/10 09:11:340B / 0B / 23B

Befunge _

RankUserSizeTimeDateStatistics
1hako80.03422019/04/15 09:44:240B / 2B / 6B
2Histocrat80.03142019/04/17 03:02:030B / 2B / 6B

Hexagony _

RankUserSizeTimeDateStatistics
1hako120.08932019/04/12 01:23:220B / ?B / ?B

><> _

RankUserSizeTimeDateStatistics
1mitchs90.16322019/04/09 10:15:150B / 5B / 4B
2Unihedron ユニ110.16052019/04/10 08:48:510B / 6B / 5B

GolfScript _

RankUserSizeTimeDateStatistics
1mitchs40.04582019/04/10 01:04:480B / 2B / 2B
2tails40.04332019/04/10 12:00:240B / 2B / 2B
3clock40.04402019/04/11 22:34:070B / 2B / 2B

gs2 _

RankUserSizeTimeDateStatistics
1tails50.18452019/04/10 12:31:382B / 3B / 0B

FerNANDo _

RankUserSizeTimeDateStatistics
1tails (alnum)410.11202019/04/09 12:06:200B / 21B / 0B

Vim _

RankUserSizeTimeDateStatistics
1FizzyTea90.02812019/04/10 07:00:041B / 7B / 1B
2clock90.02922019/04/10 09:12:261B / 7B / 1B

goruby _

RankUserSizeTimeDateStatistics
1clock110.06162019/04/21 11:21:120B / 6B / 4B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o214.22842019/04/13 16:34:430B / 18B / 3B
2clock214.06592019/04/20 12:07:450B / 18B / 3B

Language Ranking_

RankLangUserSizeScore
1GolfScriptmitchs410000
2gs2tails58000
3dctails85000
4Befungehako85000
5><>mitchs94444
6VimFizzyTea94444
7sedclock113636
8gorubyclock113636
9RubyHistocrat (embed)123333
10Hexagonyhako123333
11Perltails142857
12Ruby2hako142857
13wakeclock142857
14Brainfuckmitchs142857
15Python3clock192105
16Scalarotary-o211904
17Pythonclock221818
18Bash (builtins)tails231739
19Luaclock231739
20JavaScriptFizzyTea241666
21Cnu321250
22FerNANDotails (alnum)41975

return to the top page