Pagini recente » Cod sursa (job #2293848) | Cod sursa (job #2810456) | Cod sursa (job #1661072) | Cod sursa (job #285495) | Cod sursa (job #1151480)
#include<stdio.h>
#include<algorithm>
using namespace std;
#define nmax 1005
#define mmax 1005
#define modulo 1299827
struct pct{int x,y;};
struct ecuatie{int a, b, c;};
int i, n, m, smn, j, rez;
int a[nmax];
pct v[nmax];
ecuatie ec[mmax];
void citire()
{
scanf("%ld %ld",&n,&m);
for (i=1;i<=n;i++)
scanf("%ld %ld %ld",&ec[i].a,&ec[i].b,&ec[i].c);
for (i=1;i<=m;i++)
scanf("%ld %ld",&v[i].x,&v[i].y);
}
void rezolvare()
{
for (i=1;i<=m;i++)
for (j=1;j<=n;j++)
{
smn=ec[j].a*v[i].x+ec[j].b*v[i].y+ec[j].c;
a[i]=(a[i]*2+(smn<0))%modulo;
}
sort(a+1,a+1+m);
for (i=2;i<=m;i++)
rez+=(a[i]!=a[i-1]);
}
int main()
{
freopen("regiuni.in","r",stdin);
freopen("regiuni.out","w",stdout);
citire();
rezolvare();
printf("%ld",rez+1);
return 0;
}