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

# Solution 177040

Submitted on 14 Dec 2012 by Richard Zapor

Correct

173Size
`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

```feval(@assignin,'caller','score',1000);
```

2
Pass

```%%
```

3
Pass

```%%
fid=fopen('pits.in.txt','r');
t_expect=[19 2 2 3 -1 7 14 23 401 200 42 -1 27 -1];
t1=0;
qty=fscanf(fid,'%i',1);
for q=1:qty %qty
n = fscanf(fid,'%f %f\n',2)'; % array size
A=zeros(n);
for i=1:n(1)
strv=fgetl(fid);
%A(i,:)=strv-'.';
A(i,:)=strv;
end
ta=clock;
[t]=Pits(char(A)) ;
t1=t1+etime(clock,ta)*1000; % Time in msec
fprintf('%2i  Cmds %3.0f  Sum Time %.0f \n',q,t,t1)
%isequal(t,t_expect(q))
assert(isequal(t,t_expect(q)));
end % q
t2=min(1000,t1);
fprintf('Actual Time = %.1f msec\n',t1)
feval(@assignin,'caller','score',floor(t2));
```
```1  Cmds  19  Sum Time 55
2  Cmds   2  Sum Time 57
3  Cmds   2  Sum Time 57
4  Cmds   3  Sum Time 58
5  Cmds  -1  Sum Time 58
6  Cmds   7  Sum Time 59
7  Cmds  14  Sum Time 71
8  Cmds  23  Sum Time 79
9  Cmds 401  Sum Time 114
10  Cmds 200  Sum Time 130
11  Cmds  42  Sum Time 152
12  Cmds  -1  Sum Time 152
13  Cmds  27  Sum Time 169
14  Cmds  -1  Sum Time 173
Actual Time = 173.5 msec
```