Cody

# Problem 44466. The twelve days of Christmas

Solution 3441688

Submitted on 27 Oct 2020
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   Fail
% The Test Suite will be updated if inappropriate submissions are received. % This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'. % EDIT (2019-06-24). Anti-hacking provision % Ensure builtin function will be called. (Probably only the second of these will work.) ! del fileread.m ! rm -v fileread.m % Probably only the second of these will work. RE = regexp(fileread('twelvetide.m'), '\w+', 'match'); %tabooWords = {'ans', 'assert', 'freepass', 'tic'}; tabooWords = {'assert', 'freepass'}; 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( cellfun( @(z) ismember(z, tabooWords), RE ) ), msg) % END EDIT (2019-06-24)

Error using fileread (line 23) Could not open file twelvetide.m. No such file or directory. Error in Test1 (line 9) RE = regexp(fileread('twelvetide.m'), '\w+', 'match');

2   Fail

Error using fileread (line 23) Could not open file twelvetide.m. No such file or directory. Error in Test2 (line 3) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[120,165,220,286]),regexp(fileread('twelvetide.m'),'[\d\.\+\-\*\/]+','match'))), 'Please do not hard-code your ''solution''.')

3   Fail
day = 0 - randi(50); accumulatedGifts = 0; assert( isequal(twelvetide(day), accumulatedGifts) )

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test3 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

4   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test4 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

5   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test5 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

6   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test6 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

7   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test7 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

8   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test8 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

9   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test9 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

10   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test10 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

11   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test11 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

12   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test12 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

13   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test13 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

14   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test14 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

15   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test15 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

16   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test16 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

17   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test17 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

18   Fail

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test18 (line 3) assert( isequal(twelvetide(day), accumulatedGifts) )

19   Fail
for i = 1 : 10 day = 12 + randi(300); accumulatedGifts = 364; assert( isequal(twelvetide(day), accumulatedGifts) ) end;

Undefined function 'twelvetide' for input arguments of type 'double'. Error in Test19 (line 4) assert( isequal(twelvetide(day), accumulatedGifts) )

### Community Treasure Hunt

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

Start Hunting!