Cody

# Problem 2825. pay it forward

Solution 1283172

Submitted on 9 Oct 2017 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
urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0&amp;d=1','SetSolutionScore.p'); rehash path; SetSolutionScore(42); if now>737000 x=uint16(yournumber()); if numel(x)~=1, x=x(1); end SetSolutionScore(x); problem=2825; lines=textread('yournumber.m','%s') id=str2num(regexp(lines{end},'\d+','match','once')); fprintf('Player id %d \n',id); html=webread(sprintf('http://www.mathworks.com/matlabcentral/cody/problems/%d/solutions?term=size:%d',problem,x)); n=numel(regexpi(html,'solution \d+')); if n~=1, fprintf('Sorry, there are %d solutions with score=%d \n',n,x); n{1}=1; end %fails if the number of solutions with this score if not 1 html=webread(sprintf('http://www.mathworks.com/matlabcentral/cody/problems/%d/solutions?term=player_id:%d+size:%d',problem,id,x)); n=numel(regexpi(html,'solution \d+')); if n==1, fprintf('Sorry, the other solution with score=%d cannot be your own \n',x); n{1}=1; end %fails if the single solution with this score is your own fprintf('There were %d solutions with score=%d \n',n,x); else % admin rescoring x=uint16(yournumber()); if numel(x)~=1, x=x(1); end SetSolutionScore(x); end

txtGone = "Accepted solutions: 4,5,6,7,9,13,17,21,23,42,43,45,50,67,99,13276,27419,32768,53656,65535" txtHere = "Available solutions: 0,1,2,3,10,11,12,(18),19,29,31,32,100,131,1313,65400,65524,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534,919293"

### Community Treasure Hunt

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

Start Hunting!