Pagini recente » Cod sursa (job #2602855) | Cod sursa (job #2303905) | Cod sursa (job #760476) | Cod sursa (job #3284142) | Cod sursa (job #1321988)
#include <stdio.h>
#include <vector>
#include <algorithm>
#define NMAX 1010
#define MOD 12998111
struct Ecuatie {
short int a, b, c;
};
struct Punct {
short int x, y;
int regiune;
Punct (short int x, short int y) {
this->x = x;
this->y = y;
this->regiune = 0;
}
};
int n, m;
//Ecuatie dreapta[NMAX];
std::vector <Punct> punct;
void citeste() {
//ifstream f ("regiuni.in");
freopen("regiuni.in", "r", stdin);
//f >> n >> m;
scanf("%d", &n);
scanf("%d", &m);
short int a, b, c;
punct.push_back(Punct(0, 0));
for (int i = 1; i <= n; i++) {
scanf("%hd", &a);
scanf("%hd", &b);
scanf("%hd", &c);
}
for (int i = 1; i <= m; i++) {
scanf("%hd", &a);
scanf("%hd", &b);
punct.push_back(Punct(a, b));
}
}
bool comp(Punct a, Punct b) {
return a.regiune < b.regiune;
}
void rezolva() {
short int rez;
Ecuatie dreapta;
freopen("regiuni.in", "r", stdin);
scanf("%d", &n);
scanf("%d", &m);
for (int i = 1; i <= n; i++) {
scanf("%hd", &dreapta.a);
scanf("%hd", &dreapta.b);
scanf("%hd", &dreapta.c);
for (int j = 1; j <= m; j++) {
rez = dreapta.a * punct[j].x + dreapta.b * punct[j].y + dreapta.c;
if (rez < 0) punct[j].regiune = ((punct[j].regiune) * 10 + 1) % MOD;
else punct[j].regiune = ((punct[j].regiune) * 10 + 2) % MOD;
}
}
}
void numara() {
freopen("regiuni.out", "w", stdout);
short int sol = 1;
for (int i = 2; i <= m; i++)
if (punct[i].regiune != punct[i - 1].regiune) sol++;
printf("%hd\n", sol);
}
int main() {
citeste();
rezolva();
sort (punct.begin(), punct.end(), comp);
numara();
return 0;
}