|
|
вернуться в форумhelp why i wa5 program ural; var n,l,i,p,q:integer; x,y:array[1..2]of integer; a,b:integer; c,u:array[1..10000]of boolean; begin readln(n,l); if n=1 then begin writeln('YES'); writeln('+'); halt; end; l:=l*l; readln(x[1],y[1]); readln(x[2],y[2]); c[1]:=true; c[2]:=true; for i:=3 to n do begin readln(a,b); p:=x[1]+a; q:=y[1]+b; if sqr(p)+sqr(q)<=l then begin x[1]:=p; y[1]:=q; u[i]:=true; c[i]:=true; continue; end; p:=x[1]-a; q:=y[1]-b; if sqr(p)+sqr(q)<=l then begin x[1]:=p; y[1]:=q; u[i]:=true; continue; end; p:=x[2]+a; q:=y[2]+b; if sqr(p)+sqr(q)<=l then begin x[2]:=p; y[2]:=q; c[i]:=true; continue; end; p:=x[2]-a; q:=y[2]-b; if sqr(p)+sqr(q)<=l then begin x[2]:=p; y[2]:=q; continue; end; end; if sqr(x[1]+x[2])+sqr(y[1]+y[2])>2*l then c[2]:=not c[2]; writeln('YES'); write('+'); if c[2] then write('+') else write('-'); for i:=3 to n do begin if u[i] then begin if c[i] then write('+') else write('-'); end else begin if c[i]=false then c[i]:=not c[2]; if c[i] then write('+') else write('-'); end; end; end. Re: help why i wa5 try this test 3 10 10 0 0 10 5 5 |
|
|