|
|
вернуться в форумlooking for help...... WA#2 program p1207; uses math; type realer=record rr:real; num:longint; end; var i,j,k,n,m,x,y,x0,y0:longint; r:array[1..10000]of realer; procedure qs(h,t:longint); var i,j:longint; k:real; o:realer; begin if h>=t then exit; i:=h;j:=t;k:=r[(i+j)div 2].rr; repeat while r[i].rr<k do inc(i); while r[j].rr>k do dec(j); if i<=j then begin o:=r[i]; r[i]:=r[j]; r[j]:=o; inc(i); dec(j); end; until i>j; qs(h,j); qs(i,t); end; begin readln(n); readln(x0,y0); for i:=2 to n do begin readln(x,y); x:=x-x0; y:=y-y0; if x=0 then if y>0 then r[i-1].rr:=0.5*pi else r[i-1].rr:=-0.5*pi else r[i-1].rr:=arctan(y/x); r[i-1].num:=i; end; qs(1,n-1); writeln(1,' ',r[n div 2].num); end. Re: looking for help...... WA#2 Any hints or tests can be helpful! Thanks! Re: looking for help...... WA#2 This test helped me to kill WA2 2 1 1 -1 -1 And don't forget about size of types! test Послано BaJIuK 14 янв 2012 13:07 4 -999999999 1000000000 -1000000000 999999999 1000000000 -1000000000 -1000000000 1000000000 out: 3 4 |
|
|