I did not expect that this Solution would pass. . . . Solution 556171 was submitted on 12 Jan 2015 with Size = 65535 by unknown Player (first instance, so marked as incorrect).
Solution 557603 was submitted on 14 Jan 2015 with Size = 65535 by Michael C. (second instance, so marked as correct).
Solution 828081 was submitted on 15 Feb 2016 with Size = 65535 by unknown Player (third instance, so marked as incorrect). . . . So this here would be the fourth instance, no?
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0&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
|
2183 Solvers
Number of 1s in the Binary Representation of a Number
356 Solvers
Create a vector whose elements depend on the previous element
391 Solvers
147 Solvers
Deleting an element in a matrix
325 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!