Cody

Solution 1448425

Submitted on 24 Feb 2018 by Eran Shvartzman
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('MeanWhile.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'sum')),'sum() function is forbidden')

3   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'mean')),'mean() function is forbidden')

4   Pass
rng(1); av_correct = 5.5; assert(isequal(MeanWhile(),av_correct))

c = 1 v = 4 s = 4 a = 4 c = 2 v = 4 7 s = 11 a = 5.5000 a = 5.5000

5   Pass
rng(2); av_correct = 4; assert(isequal(MeanWhile(),av_correct))

c = 1 v = 4 s = 4 a = 4 a = 4

6   Pass
rng(3); av_correct = 5.25; assert(isequal(MeanWhile(),av_correct))

c = 1 v = 6 s = 6 a = 6 c = 2 v = 6 7 s = 13 a = 6.5000 c = 3 v = 6 7 3 s = 16 a = 5.3333 c = 4 v = 6 7 3 5 s = 21 a = 5.2500 c = 5 v = 6 7 3 5 9 s = 30 a = 6 c = 6 v = 6 7 3 5 9 9 s = 39 a = 6.5000 c = 7 v = 6 7 3 5 9 9 1 s = 40 a = 5.7143 c = 8 v = 6 7 3 5 9 9 1 2 s = 42 a = 5.2500 a = 5.2500

7   Pass
rng(7); av_correct = 0; assert(isequal(MeanWhile(),av_correct))

a = 0

8   Pass
rng(0); av_correct = 6.571428571428571; assert(isequal(MeanWhile(),av_correct))

c = 1 v = 8 s = 8 a = 8 c = 2 v = 8 9 s = 17 a = 8.5000 c = 3 v = 8 9 1 s = 18 a = 6 c = 4 v = 8 9 1 10 s = 28 a = 7 c = 5 v = 8 9 1 10 6 s = 34 a = 6.8000 c = 6 v = 8 9 1 10 6 1 s = 35 a = 5.8333 c = 7 v = 8 9 1 10 6 1 3 s = 38 a = 5.4286 c = 8 v = 8 9 1 10 6 1 3 6 s = 44 a = 5.5000 c = 9 v = 8 9 1 10 6 1 3 6 10 s = 54 a = 6 c = 10 v = 8 9 1 10 6 1 3 6 10 10 s = 64 a = 6.4000 c = 11 v = 8 9 1 10 6 1 3 6 10 10 1 s = 65 a = 5.9091 c = 12 v = 8 9 1 10 6 1 3 6 10 10 1 10 s = 75 a = 6.2500 c = 13 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 s = 85 a = 6.5385 c = 14 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 s = 90 a = 6.4286 c = 15 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 s = 98 a = 6.5333 c = 16 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 s = 99 a = 6.1875 c = 17 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 s = 103 a = 6.0588 c = 18 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 s = 113 a = 6.2778 c = 19 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 s = 121 a = 6.3684 c = 20 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 s = 131 a = 6.5500 c = 21 v = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 7 s = 138 a = 6.5714 a = 6.5714