Cody

Problem 44637. Still more miles to go before I sleep

Solution 1585072

Submitted on 16 Jul 2018 by goc3
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))

d = 659

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

d = 87659

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

d = 0

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

d = 544445

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

d = 92485

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

d = 192485

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

d = 876543211 d = 76543211 d = 6543211 d = 543211 d = 43211 d = 3211 d = 211 d = 11 d = 0

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

d = 0 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 88 d = 87 d = 86 d = 85 d = 84 d = 83 d = 82 d = 81 d = 80 d = 79 d = 78 d = 77 d = 76 d = 75 d = 74 d = 73 d = 72 d = 71 d = 70 d = 69 d = 68 d = 67 d = 66 d = 65 d = 64 d = 63 d = 62 d = 61 d = 60 d = 59 d = 58 d = 57 d = 56 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 888 d = 887 d = 886 d = 885 d = 884 d = 883 d = 882 d = 881 d = 880 d = 879 d = 878 d = 877 d = 876 d = 875 d = 874 d = 873 d = 872 d = 871 d = 870 d = 869 d = 868 d = 867 d = 866 d = 865 d = 864 d = 863 d = 862 d = 861 d = 860 d = 859 d = 858 d = 857 d = 856 d = 855 d = 854 d = 853 d = 852 d = 851 d = 850 d = 849 d = 848 d = 847 d = 846 d = 845 d = 844 d = 843 d = 842 d = 841 d = 840 d = 839 d = 838 d = 837 d = 836 d = 835 d = 834 d = 833 d = 832 d = 831 d = 830 d = 829 d = 828 d = 827 d = 826 d = 825 d = 824 d = 823 d = 822 d = 821 d = 820 d = 819 d = 818 d = 817 d = 816 d = 815 d = 814 d = 813 d = 812 d = 811 d = 810 d = 809 d = 808 d = 807 d = 806 d = 805 d = 804 d = 803 d = 802 d = 801 d = 800 d = 0 d = 0 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 77 d = 76 d = 75 d = 74 d = 73 d = 72 d = 71 d = 70 d = 69 d = 68 d = 67 d = 66 d = 65 d = 64 d = 63 d = 62 d = 61 d = 60 d = 59 d = 58 d = 57 d = 56 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 77 d = 76 d = 75 d = 74 d = 73 d = 72 d = 71 d = 70 d = 69 d = 68 d = 67 d = 66 d = 65 d = 64 d = 63 d = 62 d = 61 d = 60 d = 59 d = 58 d = 57 d = 56 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 66 d = 65 d = 64 d = 63 d = 62 d = 61 d = 60 d = 59 d = 58 d = 57 d = 56 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 66 d = 65 d = 64 d = 63 d = 62 d = 61 d = 60 d = 59 d = 58 d = 57 d = 56 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 55 d = 54 d = 53 d = 52 d = 51 d = 50 d = 49 d = 48 d = 47 d = 46 d = 45 d = 44 d = 43 d = 42 d = 41 d = 40 d = 39 d = 38 d = 37 d = 36 d = 35 d = 34 d = 33 d = 32 d = 31 d = 30 d = 29 d = 28 d = 27 d = 26 d = 25 d = 24 d = 23 d = 22 d = 21 d = 20 d = 19 d = 18 d = 17 d = 16 d = 15 d = 14 d = 13 d = 12 d = 11 d = 10 d = 9 d = 8 d = 7 d = 6 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = 5 d = 4 d = 3 d = 2 d = 1 d = 0 d = 0 d = 0 d = 0 d = 0 d = ...