Cody

Problem 42318. Evened up (or not)

Solution 2701544

Submitted on 16 Jul 2020
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   Fail
M = 1:10; e = 1; M_corr = [2,2,4,4,6,6,8,8,10,10]; assert(isequal(evened_up(M,e),M_corr))

M = 1 3 3 5 5 7 7 9 9 11

Assertion failed.

2   Fail
M = 1:10; e = 0; M_corr = [1,3,3,5,5,7,7,9,9,11]; assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

3   Fail
M = 20:3:50; e = 1; M_corr = [20,24,26,30,32,36,38,42,44,48,50]; assert(isequal(evened_up(M,e),M_corr))

M = 21 23 27 29 33 35 39 41 45 47 51

Assertion failed.

4   Fail
M = 20:3:50; e = 0; M_corr = [21,23,27,29,33,35,39,41,45,47,51]; assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

5   Fail
M = 2:2:100; e = 1; M_corr = M; assert(isequal(evened_up(M,e),M_corr))

M = Columns 1 through 30 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 Columns 31 through 50 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101

Assertion failed.

6   Fail
M = 2:2:100; e = 0; M_corr = M+1; assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

7   Fail
M = ones(3); e = 1; M_corr = M*2; assert(isequal(evened_up(M,e),M_corr))

M = 1 1 1 1 1 1 1 1 1

Assertion failed.

8   Fail
M = magic(3); e = 0; M_corr = [9,1,7;3,5,7;5,9,3]; assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

9   Fail
M = magic(3); e = 1; M_corr = [8,2,6;4,6,8;4,10,2]; assert(isequal(evened_up(M,e),M_corr))

M = 9 1 7 3 5 7 5 9 3

Assertion failed.

10   Fail
M = eye(4); e = 1; M_corr = M*2; assert(isequal(evened_up(M,e),M_corr))

M = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Assertion failed.

11   Fail
M = eye(4); e = 0; M_corr = ones(4); assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

12   Fail
ind = randi(4); switch ind case 1 M = 1:10; e = 1; M_corr = [2,2,4,4,6,6,8,8,10,10]; case 2 M = 20:3:50; e = 1; M_corr = [20,24,26,30,32,36,38,42,44,48,50]; case 3 M = ones(3); e = 1; M_corr = M*2; case 4 M = eye(4); e = 0; M_corr = ones(4); end assert(isequal(evened_up(M,e),M_corr))

M = 1 1 1 1 1 1 1 1 1

Assertion failed.

13   Fail
ind = randi(4); switch ind case 1 M = 2:2:100; e = 0; M_corr = M+1; case 2 M = 1:10; e = 0; M_corr = [1,3,3,5,5,7,7,9,9,11]; case 3 M = 1:10; e = 1; M_corr = [2,2,4,4,6,6,8,8,10,10]; case 4 M = magic(3); e = 0; M_corr = [9,1,7;3,5,7;5,9,3]; end assert(isequal(evened_up(M,e),M_corr))

Assertion failed.

14   Fail
ind = randi(4); switch ind case 1 M = eye(4); e = 0; M_corr = ones(4); case 2 M = ones(3); e = 1; M_corr = M*2; case 3 M = 20:3:50; e = 1; M_corr = [20,24,26,30,32,36,38,42,44,48,50]; case 4 M = 2:2:100; e = 1; M_corr = M; end assert(isequal(evened_up(M,e),M_corr))

M = 1 1 1 1 1 1 1 1 1

Assertion failed.