Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 187804

Submitted on 8 Jan 2013

Incorrect

229Size
Leading solution size is 98.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
tic
urlwrite('http://contest.usc.edu/index.php/Fall12/Home?action=download&upname=driving.in.txt','driving.in.txt');
toc
Elapsed time is 0.404597 seconds.
2
Fail
 
%%
 fid=fopen('driving.in.txt','r');
 xy_expect=[3 2;2 29;107 23;-79 -72];
 qty=fscanf(fid,'%i',1);
 for q=1:qty %qty
  n = fscanf(fid,'%f\n',1); % commands
  m=cell(n,1);
  for i=1:n
   m{i}=fgetl(fid);
  end
   [xy]=Drive(m) ;
   assert(isequal(xy,xy_expect(q,:)))
%   fprintf('Q %i  x %i  y %i  Pass %i\n',q,xy,tf)
 end % q
 fclose(fid);
toc
Error: Assertion failed.