Pagini recente » Cod sursa (job #1008152) | Cod sursa (job #2337465) | Cod sursa (job #1934358) | Cod sursa (job #3259068) | Cod sursa (job #37906)
Cod sursa(job #37906)
var f,g:text;
a,b:array[1..513]of real;
n,i,x,y,z,t,j,p,ir:integer;
s:array[1..512,0..512]of integer;
c,l:array[1..512]of integer;
r:array[1..10000]of real;
begin
assign(f,'laser.in');
reset(f);
readln(f,n);
for i:=1 to n do begin
readln(f,x,y,z,t);
a[i]:=arctan(y/x)*180/pi;
if x>0 then if y>0 then
else a[i]:=a[i]+270
else if y>0 then a[i]:=a[i]+180
else a[i]:=360-a[i];
b[i]:=arctan(t/z)*180/pi;
if t>0 then if z>0 then
else b[i]:=b[i]+270
else if z>0 then b[i]:=b[i]+180
else b[i]:=360-b[i];
if a[i]<b[i] then if b[i]-a[i]>180 then begin
l[i]:=1;
end
else
else if a[i]-b[i]<180 then begin
a[i+1]:=a[i];
a[i]:=b[i];
b[i]:=a[i+1];
end
else begin
l[i]:=1;
a[i+1]:=a[i];
a[i]:=b[i];
b[i]:=a[i+1];
end;
end;
c[n+1]:=1;
for i:=1 to n do read(f,c[i]);
for i:=1 to n do begin
for j:=1 to n do begin
if l[j]=0 then if (a[i]>=a[j])and(a[i]<=b[j]) then begin
s[i,0]:=s[i,0]+1;
s[i,s[i,0]]:=j;
end
else
else if (a[i]<=a[j])or(a[i]>=b[j]) then begin
s[i,0]:=s[i,0]+1;
s[i,s[i,0]]:=j;
end;
end;
end;
p:=1;
while c[p]=0 do p:=p+1;
while p<n+1 do begin
ir:=ir+1;
r[ir]:=a[p];
for i:=1 to s[p,0] do if c[s[p,i]]=0 then c[s[p,i]]:=1
else c[s[p,i]]:=0;
p:=1;
while c[p]=0 do p:=p+1;
end;
assign(g,'laser.out');
rewrite(g);
writeln(g,ir);
for i:=1 to ir do writeln(g,r[i]:0:6);
close(g);
end.