Problem 44637. Still more miles to go before I sleep

Solution 2785480

Submitted on 5 Aug 2020
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
r=12341;b=4; assert(isequal(miles2(r,b),659))

Assertion failed.

2   Fail
r=12341;b=2; assert(isequal(miles2(r,b),87659))

Assertion failed.

3   Fail
r=12331;b=4; assert(isequal(miles2(r,b),0))

Assertion failed.

4   Fail
r=455555;b=5; assert(isequal(miles2(r,b),544445))

Assertion failed.

5   Fail
r=23907515;b=5; assert(isequal(miles2(r,b),92485))

Assertion failed.

6   Fail
r=23807515;b=8; assert(isequal(miles2(r,b),192485))

Assertion failed.

7   Fail
s=zeros(1,10); for b=2:10 s(b)=miles2(123456789,b); end assert(isequal(sum(s),960219488))

Unable to perform assignment because the left and right sides have a different number of elements. Error in Test7 (line 3) s(b)=miles2(123456789,b);

8   Fail
s=zeros(200,10); for b=2:10 for r=1:200 s(r,b)=miles2(r,b); end end assert(isequal(sum(s(:)),96940))

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2. Error in Test8 (line 4) s(r,b)=miles2(r,b);