Problem 44637. Still more miles to go before I sleep

Solution 3270658

Submitted on 19 Oct 2020 by Goktug Saray
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   Pass
r=12341;b=2; assert(isequal(miles2(r,b),87659))

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

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

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

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

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

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

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!