记录编号 |
7321 |
评测结果 |
WWAAWWWWWW |
题目名称 |
[USACO Dec08] 花园栅栏 |
最终得分 |
20 |
用户昵称 |
bly1991 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.014 s |
提交时间 |
2008-11-09 11:23:31 |
内存使用 |
0.13 MiB |
显示代码纯文本
program bly(input,output);
type
t1=record
xx:boolean;
yy:boolean;
end;
var
wall,ans:array[-1..100,-1..100,1..1] of boolean;
i,j:integer;
st:char;
k,x,y,n,w:integer;
f1,f2:text;
begin
assign(f1,'fence.in');
reset(f1);
readln(f1,x,y,n);
for i:=1 to n do begin
readln(f1,st,k);
case st of
'N':begin
for j:=y to y+k-1 do wall[x,j,1]:=true;
y:=y+k;
end;
'S':begin
for j:=y downto y-k+1 do wall[x,j,1]:=true;
y:=y-k;
end;
'E':begin
for j:=x to x+k-1 do wall[j,y,1]:=true;
x:=x+k;
end;
'W':begin
for j:=x downto x-k+1 do wall[j,y,1]:=true;
x:=x-k;
end;
end;
end;
close(f1);
for i:=0 to 100 do begin
for j:=0 to 100 do begin
if wall[i,j,1]=false then begin ans[i,j,1]:=true; end
else break;
end;
end;
for i:=0 to 100 do begin
for j:=100 downto 0 do begin
if wall[i,j,1]=false then begin ans[i,j,1]:=true; end
else break;
end;
end;
for i:=100 downto 0 do begin
for j:=0 to 100 do begin
if wall[i,j,1]=false then begin ans[i,j,1]:=true; end
else break;
end;
end;
for i:=100 downto 0 do begin
for j:=100 downto 0 do begin
if wall[i,j,1]=false then begin ans[i,j,1]:=true end
else break;
end;
end;
for i:=0 to 100 do begin
for j:=0 to 100 do begin
if ans[i,j,1]=true then inc(w);
end;
end;
assign(f2,'fence.out');
rewrite(f2);
writeln(f2,100*100-w);
close(f2);
end.