Cody

Problem 44637. Still more miles to go before I sleep

Solution 3277308

Submitted on 19 Oct 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   Pass
r=12341;b=4; assert(isequal(miles2(r,b),659))

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))

Assertion failed.

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))

Assertion failed.

Suggested Problems

More from this Author80

Community Treasure Hunt

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

Start Hunting!