Pagini recente » Cod sursa (job #642928) | Cod sursa (job #2445477) | Cod sursa (job #1569029) | Cod sursa (job #2309484) | Cod sursa (job #1580013)
#include <bits/stdc++.h>
#define P 123457
#define Q 799999
using namespace std;
int n, m;
struct punct
{
short a, b, c;
};
punct d[1005];
int t[1005], v[1005];
void regiune(int x, int y, int &hp, int &hq)
{
int i;
hp = hq = 0;
for(i = 1; i <= n; i++)
{
if(d[i].a * x + d[i].b * y + d[i].c > 0)
{
hp = (hp * 10 + 1) % P;
hq = (hq * 10 + 1) % Q;
}
else
{
hp = (hp * 10 + 2) % P;
hq = (hq * 10 + 2) % Q;
}
}
}
int main()
{
int i, x, y, hp, hq, j;
bool gasit;
ifstream fin("regiuni.in");
fin >> n >> m;
for(i = 1; i <= n; i++)
fin >> d[i].a >> d[i].b >> d[i].c;
for(i = 1; i <= m; i++)
{
fin >> x >> y;
regiune(x, y , hp, hq);
t[i] = hp;
v[i] = hq;
}
x = 0;
for(i = 1; i <= m; i++)
{
gasit = false;
for(j = i + 1; j <= m; j++)
if(t[j] == t[i] && v[j] == v[i])
gasit = true;
if(!gasit) x++;
}
ofstream fout("regiuni.out");
fout << x <<"\n";
fin.close();
fout.close();
return 0;
}