Cody

Solution 168848

Submitted on 27 Nov 2012 by Slobodan Ilic
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
%% s = '123454321'; i_correct = 3; assert(isequal(running_product(s),i_correct))

ans = 1 2 3 4 5 p = 120 ans = 2 3 4 5 4 p = 480 ans = 3 4 5 4 3 p = 720 ans = 4 5 4 3 2 p = 480 ans = 5 4 3 2 1 p = 120

2   Pass
%% s = '5820974944592307816406286208998628034825342117067'; i_correct = 28; assert(isequal(running_product(s),i_correct))

ans = 5 8 2 0 9 p = 0 ans = 8 2 0 9 7 p = 0 ans = 2 0 9 7 4 p = 0 ans = 0 9 7 4 9 p = 0 ans = 9 7 4 9 4 p = 9072 ans = 7 4 9 4 4 p = 4032 ans = 4 9 4 4 5 p = 2880 ans = 9 4 4 5 9 p = 6480 ans = 4 4 5 9 2 p = 1440 ans = 4 5 9 2 3 p = 1080 ans = 5 9 2 3 0 p = 0 ans = 9 2 3 0 7 p = 0 ans = 2 3 0 7 8 p = 0 ans = 3 0 7 8 1 p = 0 ans = 0 7 8 1 6 p = 0 ans = 7 8 1 6 4 p = 1344 ans = 8 1 6 4 0 p = 0 ans = 1 6 4 0 6 p = 0 ans = 6 4 0 6 2 p = 0 ans = 4 0 6 2 8 p = 0 ans = 0 6 2 8 6 p = 0 ans = 6 2 8 6 2 p = 1152 ans = 2 8 6 2 0 p = 0 ans = 8 6 2 0 8 p = 0 ans = 6 2 0 8 9 p = 0 ans = 2 0 8 9 9 p = 0 ans = 0 8 9 9 8 p = 0 ans = 8 9 9 8 6 p = 31104 ans = 9 9 8 6 2 p = 7776 ans = 9 8 6 2 8 p = 6912 ans = 8 6 2 8 0 p = 0 ans = 6 2 8 0 3 p = 0 ans = 2 8 0 3 4 p = 0 ans = 8 0 3 4 8 p = 0 ans = 0 3 4 8 2 p = 0 ans = 3 4 8 2 5 p = 960 ans = 4 8 2 5 3 p = 960 ans = 8 2 5 3 4 p = 960 ans = 2 5 3 4 2 p = 240 ans = 5 3 4 2 1 p = 120 ans = 3 4 2 1 1 p = 24 ans = 4 2 1 1 7 p = 56 ans = 2 1 1 7 0 p = 0 ans = 1 1 7 0 6 p = 0 ans = 1 7 0 6 7 p = 0

3   Pass
%% s = '141592653589793238462643383279502884197169399399999'; i_correct = 47; assert(isequal(running_product(s),i_correct))

ans = 1 4 1 5 9 p = 180 ans = 4 1 5 9 2 p = 360 ans = 1 5 9 2 6 p = 540 ans = 5 9 2 6 5 p = 2700 ans = 9 2 6 5 3 p = 1620 ans = 2 6 5 3 5 p = 900 ans = 6 5 3 5 8 p = 3600 ans = 5 3 5 8 9 p = 5400 ans = 3 5 8 9 7 p = 7560 ans = 5 8 9 7 9 p = 22680 ans = 8 9 7 9 3 p = 13608 ans = 9 7 9 3 2 p = 3402 ans = 7 9 3 2 3 p = 1134 ans = 9 3 2 3 8 p = 1296 ans = 3 2 3 8 4 p = 576 ans = 2 3 8 4 6 p = 1152 ans = 3 8 4 6 2 p = 1152 ans = 8 4 6 2 6 p = 2304 ans = 4 6 2 6 4 p = 1152 ans = 6 2 6 4 3 p = 864 ans = 2 6 4 3 3 p = 432 ans = 6 4 3 3 8 p = 1728 ans = 4 3 3 8 3 p = 864 ans = 3 3 8 3 2 p = 432 ans = 3 8 3 2 7 p = 1008 ans = 8 3 2 7 9 p = 3024 ans = 3 2 7 9 5 p = 1890 ans = 2 7 9 5 0 p = 0 ans = 7 9 5 0 2 p = 0 ans = 9 5 0 2 8 p = 0 ans = 5 0 2 8 8 p = 0 ans = 0 2 8 8 4 p = 0 ans = 2 8 8 4 1 p = 512 ans = 8 8 4 1 9 p = 2304 ans = 8 4 1 9 7 p = 2016 ans = 4 1 9 7 1 p = 252 ans = 1 9 7 1 6 p = 378 ans = 9 7 1 6 9 p = 3402 ans = 7 1 6 9 3 p = 1134 ans = 1 6 9 3 9 p = 1458 ans = 6 9 3 9 9 p = 13122 ans = 9 3 9 9 3 p = 6561 ans = 3 9 9 3 9 p = 6561 ans = 9 9 3 9 9 p = 19683 ans = 9 3 9 9 9 p = 19683 ans = 3 9 9 9 9 p = 19683 ans = 9 9 9 9 9 p = 59049

4   Pass
%% s = '7831652712019091456485669234603486104543266482133936072602'; i_correct = 21; assert(isequal(running_product(s),i_correct))

ans = 7 8 3 1 6 p = 1008 ans = 8 3 1 6 5 p = 720 ans = 3 1 6 5 2 p = 180 ans = 1 6 5 2 7 p = 420 ans = 6 5 2 7 1 p = 420 ans = 5 2 7 1 2 p = 140 ans = 2 7 1 2 0 p = 0 ans = 7 1 2 0 1 p = 0 ans = 1 2 0 1 9 p = 0 ans = 2 0 1 9 0 p = 0 ans = 0 1 9 0 9 p = 0 ans = 1 9 0 9 1 p = 0 ans = 9 0 9 1 4 p = 0 ans = 0 9 1 4 5 p = 0 ans = 9 1 4 5 6 p = 1080 ans = 1 4 5 6 4 p = 480 ans = 4 5 6 4 8 p = 3840 ans = 5 6 4 8 5 p = 4800 ans = 6 4 8 5 6 p = 5760 ans = 4 8 5 6 6 p = 5760 ans = 8 5 6 6 9 p = 12960 ans = 5 6 6 9 2 p = 3240 ans = 6 6 9 2 3 p = 1944 ans = 6 9 2 3 4 p = 1296 ans = 9 2 3 4 6 p = 1296 ans = 2 3 4 6 0 p = 0 ans = 3 4 6 0 3 p = 0 ans = 4 6 0 3 4 p = 0 ans = 6 0 3 4 8 p = 0 ans = 0 3 4 8 6 p = 0 ans = 3 4 8 6 1 p = 576 ans = 4 8 6 1 0 p = 0 ans = 8 6 1 0 4 p = 0 ans = 6 1 0 4 5 p = 0 ans = 1 0 4 5 4 p = 0 ans = 0 4 5 4 3 p = 0 ans = 4 5 4 3 2 p = 480 ans = 5 4 3 2 6 p = 720 ans = 4 3 2 6 6 p = 864 ans = 3 2 6 6 4 p = 864 ans = 2 6 6 4 8 p = 2304 ans = 6 6 4 8 2 p = 2304 ans = 6 4 8 2 1 p = 384 ans = 4 8 2 1 3 p = 192 ans = 8 2 1 3 3 p = 144 ans = 2 1 3 3 9 p = 162 ans = 1 3 3 9 3 p = 243 ans = 3 3 9 3 6 p = 1458 ans = 3 9 3 6 0 p = 0 ans = 9 3 6 0 7 p = 0 ans = 3 6 0 7 2 p = 0 ans = 6 0 7 2 6 p = 0 ans = 0 7 2 6 0 p = 0 ans = 7 2 6 0 2 p = 0

5   Pass
%% s = '70066063155881748815209209628292540917153643678925903600113305305488'; i_correct = 44; assert(isequal(running_product(s),i_correct))

ans = 7 0 0 6 6 p = 0 ans = 0 0 6 6 0 p = 0 ans = 0 6 6 0 6 p = 0 ans = 6 6 0 6 3 p = 0 ans = 6 0 6 3 1 p = 0 ans = 0 6 3 1 5 p = 0 ans = 6 3 1 5 5 p = 450 ans = 3 1 5 5 8 p = 600 ans = 1 5 5 8 8 p = 1600 ans = 5 5 8 8 1 p = 1600 ans = 5 8 8 1 7 p = 2240 ans = 8 8 1 7 4 p = 1792 ans = 8 1 7 4 8 p = 1792 ans = 1 7 4 8 8 p = 1792 ans = 7 4 8 8 1 p = 1792 ans = 4 8 8 1 5 p = 1280 ans = 8 8 1 5 2 p = 640 ans = 8 1 5 2 0 p = 0 ans = 1 5 2 0 9 p = 0 ans = 5 2 0 9 2 p = 0 ans = 2 0 9 2 0 p = 0 ans = 0 9 2 0 9 p = 0 ans = 9 2 0 9 6 p = 0 ans = 2 0 9 6 2 p = 0 ans = 0 9 6 2 8 p = 0 ans = 9 6 2 8 2 p = 1728 ans = 6 2 8 2 9 p = 1728 ans = 2 8 2 9 2 p = 576 ans = 8 2 9 2 5 p = 1440 ans = 2 9 2 5 4 p = 720 ans = 9 2 5 4 0 p = 0 ans = 2 5 4 0 9 p = 0 ans = 5 4 0 9 1 p = 0 ans = 4 0 9 1 7 p = 0 ans = 0 9 1 7 1 p = 0 ans = 9 1 7 1 5 p = 315 ans = 1 7 1 5 3 p = 105 ans = 7 1 5 3 6 p = 630 ans = 1 5 3 6 4 p = 360 ans = 5 3 6 4 3 p = 1080 ans = 3 6 4 3 6 p = 1296 ans = 6 4 3 6 7 p = 3024 ans = 4 3 6 7 8 p = 4032 ans = 3 6 7 8 9 p = 9072 ans = 6 7 8 9 2 p = 6048 ans = 7 8 9 2 5 p = 5040 ans = 8 9 2 5 9 p = 6480 ans = 9 2 5 9 0 p = 0 ans = 2 5 9 0 3 p = 0 ans = 5 9 0 3 6 p = 0 ans = 9 0 3 6 0 p = 0 ans = 0 3 6 0 0 p = 0 ans = 3 6 0 0 1 p = 0 ans = 6 0 0 1 1 p = 0 ans = 0 0 1 1 3 p = 0 ans = 0 1 1 3 3 p = 0 ans = 1 1 3 3 0 p = 0 ans = 1 3 3 0 5 p = 0 ans = 3 3 0 5 3 p = 0 ans = 3 0 5 3 0 p = 0 ans = 0 5 3 0 5 p = 0 ans = 5 3 0 5 4 p = 0 ans = 3 0 5 4 8 p = 0 ans = 0 5 4 8 8 p = 0

6   Pass
%% s = '11111'; i_correct = 1; assert(isequal(running_product(s),i_correct))

ans = 1 1 1 1 1 p = 1