Cody

Problem 2582. Cut an orange

Solution 1162263

Submitted on 13 Apr 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
N = 1; y_correct = [0 1]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 y = 0 1

2   Pass
N = 1; y_correct = [0 1]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 y = 0 1

3   Pass
N = 2; y_correct = [0 8]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 y = 0 8

4   Pass
N = 3; y_correct = [1 26]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 y = 1 26

5   Pass
N = 4; y_correct = [8 56]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 y = 8 56

6   Fail
N = 5; y_correct = [19 98]; % was [27 90] assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 y = 27 98

Assertion failed.

7   Fail
N = 6; y_correct = [32 152]; % was [56 128]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 216 y = 64 152

Assertion failed.

8   Fail
N = 7; y_correct = [81 194]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 216 343 y = 125 218

Assertion failed.

9   Fail
N = 8; y_correct = [136 272]; % was [160 248]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 216 343 512 y = 216 296

Assertion failed.

10   Fail
N = 9; y_correct = [203 362]; % was [251 314]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 216 343 512 729 y = 343 386

Assertion failed.

11   Fail
N = 10; y_correct = [304 416]; % was [312 408]; assert(isequal(cut_orange(N),y_correct))

A = 0 0 1 8 27 64 125 216 343 512 729 1000 y = 512 488

Assertion failed.

12   Fail
% finally more cubes than peels! N = 13; assert(isequal(-diff(cut_orange(N)),5))

A = Columns 1 through 14 0 0 1 8 27 64 125 216 343 512 729 1000 1331 1728 Column 15 2197 y = 1331 866

Assertion failed.

13   Fail
N = 19; y_correct = [2769 1658]; assert(isequal(cut_orange(N),y_correct))

A = Columns 1 through 14 0 0 1 8 27 64 125 216 343 512 729 1000 1331 1728 Columns 15 through 21 2197 2744 3375 4096 4913 5832 6859 y = 4913 1946

Assertion failed.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!