Cody

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

Solution 2090138

Submitted on 12 Jan 2020 by Asif Newaz
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
h = 20; m=5; n=3; y_correct = 9; assert(isequal(catdays(h,m,n),y_correct))

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

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

x = 6 x = 5 y = 1 x = 11 x = 10 y = 2 x = 16 y = 3

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

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

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

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

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

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