Pagini recente » Cod sursa (job #390818) | Cod sursa (job #2708873) | Cod sursa (job #2493983) | Cod sursa (job #908679) | Cod sursa (job #248368)
Cod sursa(job #248368)
program pascal;
var f,g:text; n,m,i,j,nr,a,b:longint; arie,sum,aux:int64; x,y:array[1..20000] of longint;
ok:boolean;
procedure citire;
begin
readln(f,n,m);
arie:=0;
for i:=1 to n do
begin
readln(f,x[i],y[i]);
if i>1 then arie:=arie+(x[i-1]*y[i]-x[i]*y[i-1]);
end;
arie:=arie+(x[n]*y[1]-x[1]*y[n]);
x[n+1]:=x[1]; y[n+1]:=y[1]; n:=n+1;
end;
procedure citire2;
begin
nr:=0;
for i:=1 to m do
begin
readln(f,a,b);
sum:=0; ok:=true;
for j:=1 to n-1 do
begin
aux:=abs(a*y[j]+x[j]*y[j+1]+x[j+1]*b-x[j+1]*y[j]-a*y[j+1]-x[j]*b);
if aux<>0 then sum:=sum+aux
else
begin
ok:=false;
break;
end;
if sum>arie then
begin
ok:=false;
break;
end;
end;
if (arie=sum) and (ok) then inc(nr);
end;
end;
begin
assign(f,'poligon.in'); reset(f);
assign(g,'poligon.out'); rewrite(g);
citire;
citire2;
write(g,nr);
close(f);
close(g);
end.