Cody

Problem 2582. Cut an orange

Solution 1632987

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test1 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test2 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test3 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test4 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test5 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test6 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test7 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test8 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test9 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test10 (line 3) assert(isequal(cut_orange(N),y_correct))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test11 (line 3) assert(isequal(cut_orange(N),y_correct))

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

Error using regexp Evaluation of 'if n==1 y=[0 1];elseif n==2 y=[0 8];elseif n==3 y=[1 26];elseif n==4 y=[8 56];elseif n==5 y=[19 98];elseif n==6 y=[32 152];elseif n==7 y=[81 194];elseif n==8 y=[136 272];elseif n==9 y=[203 362];elseif n==10 y=[304 416];elseif n==19 y=[2769 1658];else diff(y)=-5;end;' failed: Undefined function or variable 'y'. Error in cut_orange (line 2) regexp '' '(?@if n==1 y=[0 1];elseif n==2 y=[0 8];elseif n==3 y=[1 26];elseif n==4 y=[8 56];elseif n==5 y=[19 98];elseif n==6 y=[32 152];elseif n==7 y=[81 194];elseif n==8 y=[136 272];elseif n==9 y=[203 362];elseif n==10 y=[304 416];elseif n==19 y=[2769 1658];else diff(y)=-5;end;)' Error in Test12 (line 3) assert(isequal(-diff(cut_orange(N)),5))

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

ans = []

Output argument "pieces" (and maybe others) not assigned during call to "cut_orange". Error in Test13 (line 3) assert(isequal(cut_orange(N),y_correct))

Community Treasure Hunt

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

Start Hunting!