Cody

Solution 1114824

Submitted on 2 Feb 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
players=4; wishes=[3 5 1 6 3 2 4]; winner=2; assert(isequal(bbgwinner(players, wishes),winner))

w = 18 20 16 21 18 17 19 f = 1 2 3 4

2   Pass
players=4; wishes=[20 13 7 8 2 16 3]; winner=4; assert(isequal(bbgwinner(players, wishes),winner))

w = 35 28 22 23 17 31 18 f = 1 2 3 4

3   Fail
players=2 wishes=[2 1]; winner=2; assert(isequal(bbgwinner(players, wishes),winner))

players = 2 w = 17 16 f = 1 2

Assertion failed.

4   Pass
players=5; wishes=[20 13 7 8 2 16 3 1 2]; winner=4; assert(isequal(bbgwinner(players, wishes),winner))

w = 35 28 22 23 17 31 18 16 17 f = 1 2 3 4 5

5   Fail
players=5; wishes=[20 13 7 8 2 16 3 3]; winner=5; assert(isequal(bbgwinner(players, wishes),winner))

w = 35 28 22 23 17 31 18 18 f = 1 2 3 4 5

Assertion failed.

6   Pass
players=20; wishes=123.*[1:39]; winner=17 assert(isequal(bbgwinner(players, wishes),winner))

winner = 17 w = Columns 1 through 8 138 261 384 507 630 753 876 999 Columns 9 through 16 1122 1245 1368 1491 1614 1737 1860 1983 Columns 17 through 24 2106 2229 2352 2475 2598 2721 2844 2967 Columns 25 through 32 3090 3213 3336 3459 3582 3705 3828 3951 Columns 33 through 39 4074 4197 4320 4443 4566 4689 4812 f = Columns 1 through 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Columns 17 through 20 17 18 19 20

7   Pass
players=30; wishes=[1:59]; winner=18; assert(isequal(bbgwinner(players, wishes),winner))

w = Columns 1 through 16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Columns 17 through 32 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 Columns 33 through 48 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 Columns 49 through 59 64 65 66 67 68 69 70 71 72 73 74 f = Columns 1 through 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Columns 17 through 30 17 18 19 20 21 22 23 24 25 26 27 28 29 30

8   Fail
players=30; wishes=[1:54 3 1 2 4]; winner=29; assert(isequal(bbgwinner(players, wishes),winner)) %%

w = Columns 1 through 16 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Columns 17 through 32 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 Columns 33 through 48 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 Columns 49 through 58 64 65 66 67 68 69 18 16 17 19 f = Columns 1 through 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Columns 17 through 30 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Assertion failed.