With apologies for the hack. The proper solutions are more elegant.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
problem=2873;
lines=textread('lucky.m','%s');
id=str2num(regexp(lines{end},'\d+','match','once'));
html=urlread(sprintf('http://www.mathworks.com/matlabcentral/cody/problems/%d/solutions?term=player_id:%d',problem,id));
n=numel(regexpi(html,'solution \d+'));
if n>0, error('Sorry. You had your chance already'); end
if randi(10)~=lucky(), error('Good guess! but wrong, sorry...'); end
disp('Amazingly correct!')
Amazingly correct!
|
522 Solvers
232 Solvers
Celsius to Fahrenheit converter
280 Solvers
208 Solvers
167 Solvers