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

now post-mortem time, all source codes will be revealed

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

Arc _

RankUserSizeTimeDateStatistics
1pooq192.12562019/09/06 17:32:360B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1pooq290.15362019/09/06 04:38:420B / ?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

Xtal _

RankUserSizeTimeDateStatistics
1pooq310.04212019/09/04 09:02:330B / ?B / ?B

PARI/GP _

RankUserSizeTimeDateStatistics
1pooq230.03712019/09/05 17:26:390B / ?B / ?B

Cyan _

RankUserSizeTimeDateStatistics
1pooq210.85232019/10/07 22:07:260B / ?B / ?B

BASIC _

RankUserSizeTimeDateStatistics
1pooq220.03162019/09/05 01:50:470B / ?B / ?B

J _

RankUserSizeTimeDateStatistics
1pooq210.06732019/09/03 18:16:540B / ?B / ?B

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

Maxima _

RankUserSizeTimeDateStatistics
1pooq340.17482019/09/28 12:17:480B / ?B / ?B

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

jq _

RankUserSizeTimeDateStatistics
1pooq150.03172019/09/21 12:51:030B / ?B / ?B

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

R _

RankUserSizeTimeDateStatistics
1pooq220.31572019/07/27 13:15:310B / ?B / ?B

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
2whio50.17512019/05/13 03:23:042B / 3B / 0B

FerNANDo _

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

z80 _

RankUserSizeTimeDateStatistics
1McBusLuck130.03282019/07/27 17:58:166B / 5B / 1B

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
2mitchs110.09792019/04/26 06:30:550B / 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
11z80McBusLuck133076
12Perltails142857
13Ruby2hako142857
14wakeclock142857
15Brainfuckmitchs142857
16jqpooq152666
17Python3clock192105
18Arcpooq192105
19Scalarotary-o211904
20Jpooq211904
21Cyanpooq211904
22Pythonclock221818
23Rpooq221818
24BASICpooq221818
25Bash (builtins)tails231739
26Luaclock231739
27PARI/GPpooq231739
28JavaScriptFizzyTea241666
29Iopooq291379
30Xtalpooq311290
31Cnu321250
32Maximapooq341176
33FerNANDotails (alnum)41975

return to the top page