Cody

Solution 2601457

Submitted on 23 Jun 2020 by Jens Kjærgaard Boldsen
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))

ix2 = 4 ix1 = 2 y = 659

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

ix2 = 2 ix1 = 1×0 empty double row vector y = 87659

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

ix2 = 1×0 empty double row vector y = 0

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

ix2 = 2 ix1 = 1×0 empty double row vector y = 544445

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

ix2 = 3 ix1 = 2 y = 92485

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

ix2 = 3 ix1 = 2 y = 192485

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

ix2 = 2 ix1 = 1×0 empty double row vector y = 876543211 ix2 = 3 ix1 = 1 y = 76543211 ix2 = 4 ix1 = 2 y = 6543211 ix2 = 5 ix1 = 3 y = 543211 ix2 = 6 ix1 = 4 y = 43211 ix2 = 7 ix1 = 5 y = 3211 ix2 = 8 ix1 = 6 y = 211 ix2 = 9 ix1 = 7 y = 11 y = 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))

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