Cody

Solution 2546169

Submitted on 14 Jun 2020 by Nikolaos Nikolaou
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))

y = 1 2 3 4 1 A = 659

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

y = 1 2 3 4 1 A = 87659

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

y = 1 2 3 3 1 A = 0

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

y = 4 5 5 5 5 5 A = 544445

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

y = 2 3 9 0 7 5 1 5 A = 92485

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

y = 2 3 8 0 7 5 1 5 A = 192485

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

y = 1 2 3 4 5 6 7 8 9 A = 876543211 y = 1 2 3 4 5 6 7 8 9 A = 76543211 y = 1 2 3 4 5 6 7 8 9 A = 6543211 y = 1 2 3 4 5 6 7 8 9 A = 543211 y = 1 2 3 4 5 6 7 8 9 A = 43211 y = 1 2 3 4 5 6 7 8 9 A = 3211 y = 1 2 3 4 5 6 7 8 9 A = 211 y = 1 2 3 4 5 6 7 8 9 A = 11 y = 1 2 3 4 5 6 7 8 9 A = 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))

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