Cody

# Problem 44695. What score did they give?

Solution 1856296

Submitted on 24 Jun 2019 by David Verrelli
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) )

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 1×0 empty double row vector

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 1

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 1 2

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 2 3

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 3 4

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 4 5

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))

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 5

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

morningScore = 2.4545 2.5455 possibleEveningScores = 2.3333 2.4167 2.4167 2.5000 2.5000 2.5833 2.5833 2.6667 2.6667 2.7500 S = 1×0 empty double row vector

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))

morningScore = 2.2500 2.3333 possibleEveningScores = 2.1538 2.2308 2.2308 2.3077 2.3077 2.3846 2.3846 2.4615 2.4615 2.5385 S = 1 2

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))

morningScore = 2.2500 2.3333 possibleEveningScores = 2.1538 2.2308 2.2308 2.3077 2.3077 2.3846 2.3846 2.4615 2.4615 2.5385 S = 4 5

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))

morningScore = 1.5882 1.6471 possibleEveningScores = 1.5556 1.6111 1.6111 1.6667 1.6667 1.7222 1.7222 1.7778 1.7778 1.8333 S = 2 3 4

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))

morningScore = 2.5882 2.6471 possibleEveningScores = 2.5000 2.5556 2.5556 2.6111 2.6111 2.6667 2.6667 2.7222 2.7222 2.7778 S = 1

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))

morningScore = 2.5882 2.6471 possibleEveningScores = 2.5000 2.5556 2.5556 2.6111 2.6111 2.6667 2.6667 2.7222 2.7222 2.7778 S = 3 4 5

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))

morningScore = 2.5882 2.6471 possibleEveningScores = 2.5000 2.5556 2.5556 2.6111 2.6111 2.6667 2.6667 2.7222 2.7222 2.7778 S = 5

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))

morningScore = 3.3529 3.4118 possibleEveningScores = 3.2222 3.2778 3.2778 3.3333 3.3333 3.3889 3.3889 3.4444 3.4444 3.5000 S = 1

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))

morningScore = 3.3529 3.4118 possibleEveningScores = 3.2222 3.2778 3.2778 3.3333 3.3333 3.3889 3.3889 3.4444 3.4444 3.5000 S = 1 2 3

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))

morningScore = 3.3529 3.4118 possibleEveningScores = 3.2222 3.2778 3.2778 3.3333 3.3333 3.3889 3.3889 3.4444 3.4444 3.5000 S = 5

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

morningScore = 3.6667 3.6875 3.7083 3.7292 possibleEveningScores = 3.6122 3.6327 3.6531 3.6735 3.6327 3.6531 3.6735 3.6939 3.6531 3.6735 3.6939 3.7143 3.6735 3.6939 3.7143 3.7347 3.6939 3.7143 3.7347 3.7551 S = 1×0 empty double row vector

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))

morningScore = 3.6667 3.6875 3.7083 3.7292 possibleEveningScores = 3.6122 3.6327 3.6531 3.6735 3.6327 3.6531 3.6735 3.6939 3.6531 3.6735 3.6939 3.7143 3.6735 3.6939 3.7143 3.7347 3.6939 3.7143 3.7347 3.7551 S = 1 2

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))

morningScore = 3.6667 3.6875 3.7083 3.7292 possibleEveningScores = 3.6122 3.6327 3.6531 3.6735 3.6327 3.6531 3.6735 3.6939 3.6531 3.6735 3.6939 3.7143 3.6735 3.6939 3.7143 3.7347 3.6939 3.7143 3.7347 3.7551 S = 1 2 3 4 5

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))

morningScore = 3.6667 3.6875 3.7083 3.7292 possibleEveningScores = 3.6122 3.6327 3.6531 3.6735 3.6327 3.6531 3.6735 3.6939 3.6531 3.6735 3.6939 3.7143 3.6735 3.6939 3.7143 3.7347 3.6939 3.7143 3.7347 3.7551 S = 5

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

morningScore = 4.3542 4.3750 4.3958 4.4167 4.4375 possibleEveningScores = 4.2857 4.3061 4.3265 4.3469 4.3673 4.3061 4.3265 4.3469 4.3673 4.3878 4.3265 4.3469 4.3673 4.3878 4.4082 4.3469 4.3673 4.3878 4.4082 4.4286 4.3673 4.3878 4.4082 4.4286 4.4490 S = 1×0 empty double row vector

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))

morningScore = 4.3542 4.3750 4.3958 4.4167 4.4375 possibleEveningScores = 4.2857 4.3061 4.3265 4.3469 4.3673 4.3061 4.3265 4.3469 4.3673 4.3878 4.3265 4.3469 4.3673 4.3878 4.4082 4.3469 4.3673 4.3878 4.4082 4.4286 4.3673 4.3878 4.4082 4.4286 4.4490 S = 1 2 3 4

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))

morningScore = 4.3542 4.3750 4.3958 4.4167 4.4375 possibleEveningScores = 4.2857 4.3061 4.3265 4.3469 4.3673 4.3061 4.3265 4.3469 4.3673 4.3878 4.3265 4.3469 4.3673 4.3878 4.4082 4.3469 4.3673 4.3878 4.4082 4.4286 4.3673 4.3878 4.4082 4.4286 4.4490 S = 1 2 3 4 5

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

morningScore = 4.3542 4.3750 4.3958 4.4167 4.4375 possibleEveningScores = 4.2857 4.3061 4.3265 4.3469 4.3673 4.3061 4.3265 4.3469 4.3673 4.3878 4.3265 4.3469 4.3673 4.3878 4.4082 4.3469 4.3673 4.3878 4.4082 4.4286 4.3673 4.3878 4.4082 4.4286 4.4490 S = 1×0 empty double row vector

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!