Cody

Problem 1277. How many days does the cat take to climb out of the hole?

Solution 205389

Submitted on 18 Feb 2013 by Freddy
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
%% test 1 h = 20; m=5; n=3; y_correct = 9; assert(isequal(catdays(h,m,n),y_correct))

r = 5 i = 1 r = 2 r = 7 i = 2 r = 4 r = 9 i = 3 r = 6 r = 11 i = 4 r = 8 r = 13 i = 5 r = 10 r = 15 i = 6 r = 12 r = 17 i = 7 r = 14 r = 19 i = 8 r = 16 r = 21 i = 9

2   Pass
%% test 2 h = 15; m=6; n=1; y_correct = 3; assert(isequal(catdays(h,m,n),y_correct))

r = 6 i = 1 r = 5 r = 11 i = 2 r = 10 r = 16 i = 3

3   Pass
%% test 3 h = 25; m=6; n=5; y_correct = 21; assert(isequal(catdays(h,m,n),y_correct))

r = 6 i = 1 r = 1 r = 7 i = 2 r = 2 r = 8 i = 3 r = 3 r = 9 i = 4 r = 4 r = 10 i = 5 r = 5 r = 11 i = 6 r = 6 r = 12 i = 7 r = 7 r = 13 i = 8 r = 8 r = 14 i = 9 r = 9 r = 15 i = 10 r = 10 r = 16 i = 11 r = 11 r = 17 i = 12 r = 12 r = 18 i = 13 r = 13 r = 19 i = 14 r = 14 r = 20 i = 15 r = 15 r = 21 i = 16 r = 16 r = 22 i = 17 r = 17 r = 23 i = 18 r = 18 r = 24 i = 19 r = 19 r = 25 i = 20 r = 20 r = 26 i = 21

4   Pass
%% test 4 h = 22; m=6; n=5; y_correct = 18; assert(isequal(catdays(h,m,n),y_correct))

r = 6 i = 1 r = 1 r = 7 i = 2 r = 2 r = 8 i = 3 r = 3 r = 9 i = 4 r = 4 r = 10 i = 5 r = 5 r = 11 i = 6 r = 6 r = 12 i = 7 r = 7 r = 13 i = 8 r = 8 r = 14 i = 9 r = 9 r = 15 i = 10 r = 10 r = 16 i = 11 r = 11 r = 17 i = 12 r = 12 r = 18 i = 13 r = 13 r = 19 i = 14 r = 14 r = 20 i = 15 r = 15 r = 21 i = 16 r = 16 r = 22 i = 17 r = 17 r = 23 i = 18

5   Pass
%% test 5 h = 31; m=8; n=5; y_correct = 9; assert(isequal(catdays(h,m,n),y_correct))

r = 8 i = 1 r = 3 r = 11 i = 2 r = 6 r = 14 i = 3 r = 9 r = 17 i = 4 r = 12 r = 20 i = 5 r = 15 r = 23 i = 6 r = 18 r = 26 i = 7 r = 21 r = 29 i = 8 r = 24 r = 32 i = 9