Cody

Solution 1403710

Submitted on 3 Jan 2018 by GEORGIOS BEKAS
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
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('myProd.m'); assert(isempty(strfind(filetext, 'prod')),'Cannot use prod() function')

3   Pass
mat = ones(5); v_correct = ones(1, 5); assert(isequal(myProd(mat),v_correct))

prdm = 1 1 1 1 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 prdm = 1 1 1 1 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 prdm = 1 1 1 1 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 prdm = 1 1 1 1 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 prdm = 1 1 1 1 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 pr = 1 prdm = 1 1 1 1 1

4   Pass
mat = [ 1, 2, 3, 4; 5, 6, 7, 2; 2, 3, 4, 5]; v_correct = [10, 36, 84, 40]; assert(isequal(myProd(mat),prod(mat)))

prdm = 1 1 1 pr = 1 pr = 1 pr = 5 pr = 10 prdm = 10 1 1 pr = 1 pr = 2 pr = 12 pr = 36 prdm = 10 36 1 pr = 1 pr = 3 pr = 21 pr = 84 prdm = 10 36 84 pr = 1 pr = 4 pr = 8 pr = 40 prdm = 10 36 84 40

5   Pass
m = randi([5,15]); n = randi([5,15]); mat = randi(5, n, m); v_correct = prod(mat); assert(isequal(myProd(mat),prod(mat)))

prdm = 1 1 1 1 1 1 1 1 pr = 1 pr = 4 pr = 12 pr = 12 pr = 48 pr = 96 pr = 192 pr = 960 pr = 4800 prdm = 4800 1 1 1 1 1 1 1 pr = 1 pr = 1 pr = 5 pr = 20 pr = 80 pr = 240 pr = 960 pr = 4800 pr = 14400 prdm = 4800 14400 1 1 1 1 1 1 pr = 1 pr = 4 pr = 8 pr = 8 pr = 8 pr = 32 pr = 128 pr = 256 pr = 768 prdm = 4800 14400 768 1 1 1 1 1 pr = 1 pr = 5 pr = 25 pr = 75 pr = 375 pr = 1500 pr = 6000 pr = 18000 pr = 90000 prdm = 4800 14400 768 90000 1 1 1 1 pr = 1 pr = 1 pr = 3 pr = 3 pr = 12 pr = 60 pr = 180 pr = 360 pr = 1440 prdm = 4800 14400 768 90000 1440 1 1 1 pr = 1 pr = 2 pr = 6 pr = 18 pr = 90 pr = 360 pr = 1080 pr = 4320 pr = 21600 prdm = 4800 14400 768 90000 1440 21600 1 1 pr = 1 pr = 4 pr = 8 pr = 40 pr = 160 pr = 800 pr = 3200 pr = 16000 pr = 80000 prdm = 4800 14400 768 90000 1440 21600 80000 1 pr = 1 pr = 2 pr = 8 pr = 16 pr = 80 pr = 80 pr = 80 pr = 240 pr = 960 prdm = 4800 14400 768 90000 1440 21600 80000 960 pr = 1 pr = 2 pr = 4 pr = 20 pr = 20 pr = 40 pr = 120 pr = 480 pr = 1920 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 pr = 1 pr = 4 pr = 4 pr = 16 pr = 32 pr = 32 pr = 64 pr = 128 pr = 256 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 256 pr = 1 pr = 2 pr = 6 pr = 12 pr = 48 pr = 48 pr = 144 pr = 576 pr = 2304 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 256 2304 pr = 1 pr = 4 pr = 4 pr = 20 pr = 40 pr = 40 pr = 200 pr = 1000 pr = 2000 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 256 2304 2000 pr = 1 pr = 1 pr = 3 pr = 6 pr = 12 pr = 36 pr = 108 pr = 432 pr = 1728 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 256 2304 2000 1728 pr = 1 pr = 5 pr = 5 pr = 25 pr = 50 pr = 100 pr = 100 pr = 300 pr = 900 prdm = 4800 14400 768 90000 1440 21600 80000 960 1920 256 2304 2000 1728 900 pr = 1 pr = 2 pr = 10 pr = 30 pr = 150 pr = 750 pr = 3000 pr = 12000 pr = 24000 prdm = Columns 1 through 14 4800 14400 768 90000 1440 21600 80000 960 1920 256 2304 2000 1728 900 Column 15 24000