Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么我总是WrongAnsserProgram P4001; Var n,x,y,i,j,x1,y1,yredg:longint; c:char; map:array[-100..100,-100..100] of longint; fx,fy:array[1..100] of longint; function inside(x,y:longint):boolean; begin if (1<=x) and (x<=10) and (1<=y) and (y<=9) then exit(true); exit(false); end; Function solve(x,y:longint):boolean; //weather red win var i,j,p,sum,xd,yd:longint; begin solve:=false; for i:=x+1 to 10 do if map[i,y]>0 then begin if map[i,y]=2 then exit(true) else begin for j:=i+1 to 10 do begin if map[j,y]>0 then begin if map[j,y]=3 then exit(true); break; end; end; end; break; end; for i:=x-1 downto 1 do if map[i,y]>0 then begin if map[i,y]=2 then exit(true) else begin for j:=i-1 downto 1 do begin if map[j,y]>0 then begin if map[j,y]=3 then exit(true); break; end; end; end; break; end; for i:=y+1 to 9 do if map[x,i]>0 then begin if map[x,i]=2 then exit(true) else begin for j:=i+1 to 9 do begin if map[x,i]>0 then begin if map[x,i]=3 then exit(true); break; end; end; end; break; end; for i:=y-1 downto 1 do if map[x,i]>0 then begin if map[x,i]=2 then exit(true) else begin for j:=i-1 downto 1 do begin if map[x,i]>0 then begin if map[x,i]=3 then exit(true); break; end; end; end; break; end; { for i:=1 to n do begin p:=map[fx[i],fy[i]]; if p=4 then begin xd:=x-fx[i]; yd:=y-fy[i]; if (xd<>0) and (yd<>0) then begin if (xd=-1) and (yd=-2) then if map[x+1,y+1]=0 then solve:=true; if (xd=-2) and (yd=-1) then if map[x+1,y+1]=0 then solve:=true; if (xd=1) and (yd=2) then if map[x-1,y-1]=0 then solve:=true; if (xd=2) and (yd=1) then if map[x-1,y-1]=0 then solve:=true; if (xd=1) and (yd=-2) then if map[x-1,y+1]=0 then solve:=true; if (xd=2) and (yd=-1) then if map[x-1,y+1]=0 then solve:=true; if (xd=-1) and (yd=2) then if map[x+1,y-1]=0 then solve:=true; if (xd=-2) and (yd=1) then if map[x+1,y-1]=0 then solve:=true; end; end; end; } if (inside(x-2,y-1)) then if map[x-2,y-1]=4 then if map[x-1,y-1]=0 then exit(true); if (inside(x+2,y+1)) then if map[x+2,y+1]=4 then if map[x+1,y+1]=0 then exit(true); if (inside(x-1,y-2)) then if map[x-1,y-2]=4 then if map[x-1,y-1]=0 then exit(true); if (inside(x+1,y+2)) then if map[x+1,y+2]=4 then if map[x+1,y+1]=0 then exit(true); if (inside(x+2,y-1)) then if map[x+2,y-1]=4 then if map[x+1,y-1]=0 then exit(true); if (inside(x+1,y-2)) then if map[x+1,y-2]=4 then if map[x+1,y-1]=0 then exit(true); if (inside(x-2,y+1)) then if map[x-2,y+1]=4 then if map[x-1,y+1]=0 then exit(true); if (inside(x-1,y+2)) then if map[x-1,y+2]=4 then if map[x-1,y+1]=0 then exit(true); end; function main:boolean; //weather checkmate var i,j:longint; begin main:=true; if y>4 then if not(solve(x,y-1)) then main:=false; if y<6 then if not(solve(x,y+1)) then main:=false; if x>1 then if not(solve(x-1,y)) then main:=false; if x<3 then if not(solve(x+1,y)) then main:=false; end; Begin readln(n,x,y); while (n+x+y>0) do begin fillchar(map,sizeof(map),0); for i:=1 to n do begin read(c); while (c<>'G') and (c<>'R') and (c<>'C') and (c<>'H') do read(c); readln(x1,y1); fx[i]:=x1; fy[i]:=y1; if c='G' then map[x1,y1]:=2 else if c='R' then map[x1,y1]:=2 else if c='C' then map[x1,y1]:=3 else if c='H' then map[x1,y1]:=4; end; if main then writeln('YES') else writeln('NO'); readln(n,x,y); end; End. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator