Cody

Solution 1617402

Submitted on 27 Aug 2018 by Binbin Qi
  • Size: 50
  • This is the leading solution.
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
% This Test Suite can be updated if inappropriate 'hacks' are discovered % in any submitted solutions, so your submission's status may therefore change over time. assessFunctionAbsence({'regexp', 'regexpi', 'str2num'}, 'FileName','latestScore.m') RE = regexp(fileread('latestScore.m'), '\w+', 'match'); tabooWords = {'ans'}; testResult = cellfun( @(z) ismember(z, tabooWords), RE ); msg = ['Please do not do that in your code!' char([10 13]) ... 'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ... 'Banned word.' char([10 13])]; assert(~any( testResult ), msg)

2   Pass
N = 11; R = 2.5; R_new = 2.2; S = latestScore(N, R, R_new); assert( isempty(S) )

3   Pass
N = 11; R = 2.5; R_new = 2.3; S = latestScore(N, R, R_new); S_correct = 1; assert(isequal(S, S_correct))

4   Pass
N = 11; R = 2.5; R_new = 2.4; S = latestScore(N, R, R_new); S_correct = [1 2]; assert(isequal(S, S_correct))

5   Pass
N = 11; R = 2.5; R_new = 2.5; S = latestScore(N, R, R_new); S_correct = [2 3]; assert(isequal(S, S_correct))

6   Pass
N = 11; R = 2.5; R_new = 2.6; S = latestScore(N, R, R_new); S_correct = [3 4]; assert(isequal(S, S_correct))

7   Pass
N = 11; R = 2.5; R_new = 2.7; S = latestScore(N, R, R_new); S_correct = [4 5]; assert(isequal(S, S_correct))

8   Pass
N = 11; R = 2.5; R_new = 2.8; S = latestScore(N, R, R_new); S_correct = 5; assert(isequal(S, S_correct))

9   Pass
N = 11; R = 2.5; R_new = 2.9; S = latestScore(N, R, R_new); assert( isempty(S) )

10   Pass
N = 12; R = 2.3; R_new = 2.2; S = latestScore(N, R, R_new); S_correct = [1 2]; assert(isequal(S, S_correct))

11   Pass
N = 12; R = 2.3; R_new = 2.5; S = latestScore(N, R, R_new); S_correct = [4 5]; assert(isequal(S, S_correct))

12   Pass
N = 17; R = 1.6; R_new = 1.7; S = latestScore(N, R, R_new); S_correct = [2 3 4]; assert(isequal(S, S_correct))

13   Pass
N = 17; R = 2.6; R_new = 2.5; S = latestScore(N, R, R_new); S_correct = 1; assert(isequal(S, S_correct))

14   Pass
N = 17; R = 2.6; R_new = 2.7; S = latestScore(N, R, R_new); S_correct = [3 4 5]; assert(isequal(S, S_correct))

15   Pass
N = 17; R = 2.6; R_new = 2.8; S = latestScore(N, R, R_new); S_correct = 5; assert(isequal(S, S_correct))

16   Pass
N = 17; R = 3.4; R_new = 3.2; S = latestScore(N, R, R_new); S_correct = 1; assert(isequal(S, S_correct))

17   Pass
N = 17; R = 3.4; R_new = 3.3; S = latestScore(N, R, R_new); S_correct = [1 2 3]; assert(isequal(S, S_correct))

18   Pass
N = 17; R = 3.4; R_new = 3.5; S = latestScore(N, R, R_new); S_correct = 5; assert(isequal(S, S_correct))

19   Pass
N = 48; R = 3.7; R_new = 3.5; S = latestScore(N, R, R_new); assert( isempty(S) )

20   Pass
N = 48; R = 3.7; R_new = 3.6; S = latestScore(N, R, R_new); S_correct = [1 2]; assert(isequal(S, S_correct))

21   Pass
N = 48; R = 3.7; R_new = 3.7; S = latestScore(N, R, R_new); S_correct = 1:5; assert(isequal(S, S_correct))

22   Pass
N = 48; R = 3.7; R_new = 3.8; S = latestScore(N, R, R_new); S_correct = 5; assert(isequal(S, S_correct))

23   Pass
N = 48; R = 4.4; R_new = 4.2; S = latestScore(N, R, R_new); S_correct = 1:4; assert( isempty(S) )

24   Pass
N = 48; R = 4.4; R_new = 4.3; S = latestScore(N, R, R_new); S_correct = 1:4; assert(isequal(S, S_correct))

25   Pass
N = 48; R = 4.4; R_new = 4.4; S = latestScore(N, R, R_new); S_correct = 1:5; assert(isequal(S, S_correct))

26   Pass
N = 48; R = 4.4; R_new = 4.5; S = latestScore(N, R, R_new); assert( isempty(S) )