Cody

Solution 334758

Submitted on 16 Oct 2013 by Chris Cleveland
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
%% x = [1 2 3 4 5 6 7]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

X = 1 2 3 4 5 6 7 jj = 0 sum_x = 0 xi = [] ii = 1 jj = 0 X = 1 7 2 1 3 2 4 3 5 4 6 5 7 6 sum_x = 8 3 5 7 9 11 13 c = Empty matrix: 1-by-0 jj = 1 ii = 1 jj = 1 X = 1 7 6 2 1 7 3 2 1 4 3 2 5 4 3 6 5 4 7 6 5 sum_x = 14 10 6 9 12 15 18 c = 1 xx = 1 7 6 temp = 1 temp = 1 xi = 1 temp = 7 temp = 7 xi = 1 7 temp = 6 temp = 6 xi = 1 7 6

2   Pass
%% x = [2 2 2 2 2 2]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

X = 2 2 2 2 2 2 jj = 0 sum_x = 0 xi = [] ii = 1 jj = 0 X = 2 2 2 2 2 2 2 2 2 2 2 2 sum_x = 4 4 4 4 4 4 c = Empty matrix: 1-by-0 jj = 1 ii = 1 jj = 1 X = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 sum_x = 6 6 6 6 6 6 c = 1 2 3 4 5 6 xx = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 temp = 1 2 3 4 5 6 temp = 1 xi = 1 temp = 1 2 3 4 5 6 temp = 1 xi = 1 1 temp = 1 2 3 4 5 6 temp = 1 xi = 1 1 1

3   Pass
%% x = [2 5 4 5 4]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

X = 2 5 4 5 4 jj = 0 sum_x = 0 xi = [] ii = 1 jj = 0 X = 2 4 5 2 4 5 5 4 4 5 sum_x = 6 7 9 9 9 c = Empty matrix: 1-by-0 jj = 1 ii = 1 jj = 1 X = 2 4 5 5 2 4 4 5 2 5 4 5 4 5 4 sum_x = 11 11 11 14 13 c = Empty matrix: 1-by-0 jj = 2 X = 2 5 4 5 4 jj = 0 sum_x = 0 xi = [] ii = 2 jj = 0 X = 2 5 5 4 4 2 5 5 4 4 sum_x = 7 9 6 10 8 c = 4 xx = 5 5 temp = 2 4 temp = 2 xi = 2 temp = 2 4 temp = 2 xi = 2 2

4   Pass
%% x = [1 3 1 1 9 7]; xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

X = 1 3 1 1 9 7 jj = 0 sum_x = 0 xi = [] ii = 1 jj = 0 X = 1 7 3 1 1 3 1 1 9 1 7 9 sum_x = 8 4 4 2 10 16 c = Empty matrix: 1-by-0 jj = 1 X = 1 3 1 1 9 7 jj = 0 sum_x = 0 xi = [] ii = 2 jj = 0 X = 1 9 3 7 1 1 1 3 9 1 7 1 sum_x = 10 10 2 4 10 8 c = Empty matrix: 1-by-0 jj = 1 ii = 2 jj = 1 X = 1 9 1 3 7 9 1 1 7 1 3 1 9 1 3 7 1 1 sum_x = 11 19 9 5 13 9 c = 1 xx = 1 9 1 temp = 1 3 4 temp = 1 xi = 1 temp = 5 temp = 5 xi = 1 5 temp = 1 3 4 temp = 1 xi = 1 5 1

5   Pass
%% x = primes(100); xi = split_it(x); assert(isequal(sum(x(xi)),sum(x)/2));

X = 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 jj = 0 sum_x = 0 xi = [] ii = 1 jj = 0 X = 2 97 3 2 5 3 7 5 11 7 13 11 17 13 19 17 23 19 29 23 31 29 37 31 41 37 43 41 47 43 53 47 59 53 61 59 67 61 71 67 73 71 79 73 83 79 89 83 97 89 sum_x = Columns 1 through 16 99 5 8 12 18 24 30 36 42 52 60 68 78 84 90 100 Columns 17 through 25 112 120 128 138 144 152 162 172 186 c = Empty matrix: 1-by-0 jj = 1 ii = 1 jj = 1 X = 2 97 89 3 2 97 5 3 2 7 5 3 11 7 5 13 11 7 17 13 11 19 17 13 23 19 17 29 23 19 31 29 23 37 31 29 41 37 31 43 41 37 47 43 41 53 47 43 59 53 47 61 59 53 67 61 59 71 67 61 73 71 67 79 73 71 83 79 73 89 83 79 97 89 83 sum_x = Columns 1 through 16 188 102 10 15 23 31 41 49 59 71 83 97 109 121 131 143 Columns 17 through 25 159 173 187 199 211 223 235 251 269 c = Empty matrix: 1-by-0 jj = 2 ii = 1 jj = 2 X = 2 97 89 83 3 2 97 89 5 3 2 97 7 5 3 2 11 7 5 3 13 11 7 5 17 13 11 7 19 17 13 11 23 19 17 13 29 23 19 17 31 29 23 19 37 31 29 23 41 37 31 29 43 41 37 31 47 43 41 37 53 47 43 41 59 53 47 43 61 59 53 47 67 61 59 53 71 67 61 59 73 71 67 61 79 73 71 67 83 79 73 71 89 83 79 73 97 89 83 79 sum_x = Columns 1 through 16 271 191 107 17 26 36 48 60 72 88 102 120 138 152 168 184 Columns 17 through 25 202 220 240 258 272 290 306 324 348 c = Empty matrix: 1-by-0 jj = 3 ii = 1 jj = 3 X = 2 97 89 83 79 3 2 97 89 83 5 3 2 97 89 7 5 3 2 97 11 7 5 3 2 13 11 7 5 3 17 13 11 7 5 19 17 13 11 7 23 19 17 13 11 29 23 19 17 13 31 29 23 19 17 37 31 29 23 19 41 37 31 29 23 43 41 37 31 29 47 43 41 37 31 53 47 43 41 37 59 53 47 43 41 61 59 53 47 43 67 61 59 53 47 71 67 61 59 53 73 71 67 61 59 79 73 71 67 61 83 79 73 71 67 89 83 79 73 71 97 89 83 79 73 sum_x = Columns 1 through 16 350 274 196 114 28 39 53 67 83 101 119 139 161 181 199 221 Columns 17 through 25 243 263 287 311 331 351 373 395 421 c = Empty matrix: 1-by-0 jj = 4 ii = 1 jj = 4 X = 2 97 89 83 79 73 3 2 97 89 83 79 5 3 2 97 89 83 7 5 3 2 97 89 11 7 5 3 2 97 13 11 7 5 3 2 17 13 11 7 5 3 19 17 13 11 7 5 23 19 17 13 11 7 29 23 19 17 13 11 31 29 23 19 17 13 37 31 29 23 19 17 41 37 31 29 23 19 43 41 37 31 29 23 47 43 41 37 31 29 53 47 43 41 37 31 59 53 47 43 41 37 61 59 53 47 43 41 67 61 59 53 47 43 71 67 61 59 53 47 73 71 67 61 59 53 79 73 71 67 61 59 83 79 73 71 67 61 89 83 79 73 71 67 97 89 83 79 73 71 sum_x = Columns 1 through 16 423 353 279 203 125 41 56 72 90 112 132 156 180 204 228 252 Columns 17 through 25 280 304 330 358 384 410 434 462 492 c = Empty matrix: 1-by-0 jj = 5 ii = 1 jj = 5 X = 2 97 89 83 79 73 71 3 2 97 89 83 79 73 5 3 2 97 89 83 79 7 5 3 2 97 89 83 11 7 5 3 2 97 89 13 11 7 5 3 2 97 17 13 11 7 5 3 2 19 17 13 11 7 5 3 23 19 17 13 11 7 5 29 23 19 17 13 11 7 31 29 23 19 17 13 11 37 31 29 23 19 17 13 41 37 31 29 23 19 17 43 41 37 31 29 23 19 47 43 41 37 31 29 23 53 47 43 41 37 31 29 59 53 47 43 41 37 31 61 59 53 47 43 41 37 67 61 59 53 47 43 41 71 67 61 59 53 47 43 73 71 67 61 59 53 47 79 73 71 67 61 59 53 83 79 73 71 67 61 59 89 83 79 73 71 67 61 97 89 83 79 73 71 67 sum_x = Columns 1 through 16 494 426 358 286 214 138 58 75 95 119 143 169 197 223 251 281 Columns 17 through 25 311 341 371 401 431 463 493 523 559 c = Empty matrix: 1-by-0 jj = 6 X = 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 jj = 0 sum_x = 0 xi = [] ii = 2 jj = 0 X = 2 89 3 97 5 2 7 3 11 5 13 7 17 11 19 13 23 17 29 19 31 23 37 29 41 31 43 37 47 41 53 43 59 47 61 53 67 59 71 61 73 67 79 71 83 73 89 79 97 83 sum_x = Columns 1 through 16 91 100 7 10 16 20 28 32 40 48 54 66 72 80 88 96 Columns 17 through 25 106 114 126 132 140 150 156 168 180 c = Empty matrix: 1-by-0 jj = 1 ii = 2 jj = 1 X = 2 89 83 3 97 89 5 2 97 7 3 2 11 5 3 13 7 5 17 11 7 19 13 11 23 17 13 29 19 17 31 23 19 37 29 23 41 31 29 43 37 31 47 41 37 53 43 41 59 47 43 61 53 47 67 59 53 71 61 59 73 67 61 79 71 67 83 73 71 89 79 73 97 83 79 sum_x = Columns 1 through 16 174 189 104 12 19 25 35 43 53 65 73 89 101 111 125 137 Columns 17 through 25 149 161 179 191 201 217 227 241 259 c = Empty matrix: 1-by-0 jj = 2 ii = 2 jj = 2 X = 2 89 83 79 3 97 89 83 5 2 97 89 7 3 2 97 11 5 3 2 13 7 5 3 17 11 7 5 19 13 11 7 23 17 13 11 29 19 17 13 31 23 19 17 37 29 23 19 41 31 29 23 43 37 31 29 47 41 37 31 53 43 41 37 59 47 43 41 61 53 47 43 67 59 53 47 71 61 59 53 73 67 61 59 79 71 67 61 83 73 71 67 89 79 73 71 97 83 79 73 sum_x = Columns 1 through 16 253 272 193 109 21 28 40 50 64 78 90 108 124 140 156 174 Columns 17 through 25 190 204 226 244 260 278 294 312 332 c = Empty matrix: 1-by-0 jj = 3 ii = 2 jj = 3 X = 2 89 83 79 73 3 97 89 83 79 5 2 97 89 83 7 3 2 97 89 11 5 3 2 97 13 7 5 3 2 17 11 7 5 3 19 13 11 7 5 23 17 13 11 7 29 19 17 13 11 31 23 19 17 13 37 29 23 19 17 41 31 29 23 19 43 37 31 29 23 47 41 37 31 29 53 43 41 37 31 59 47 43 41 37 61 53 47 43 41 67 59 53 47 43 71 61 59 53 47 73 67 61 59 53 79 71 67 61 59 83 73 71 67 61 89 79 73 71 67 97 83 79 73 71 sum_x = Columns 1 through 16 326 351 276 198 118 30 43 55 71 89 103 125 143 163 185 205 Columns 17 through 25 227 245 269 291 313 337 355 379 403 c = Empty matrix: 1-by-0 jj = 4 ii = 2 jj = 4 X = 2 89 83 79 73 71 3 97 89 83 79 73 5 2 97 89 83 79 7 3 2 97 89 83 11 5 3 2 97 89 13 7 5 3 2 97 17 11 7 5 3 2 19 13 11 7 5 3 23 17 13 11 7 5 29 19 17 13 11 7 31 23 ...