Cod sursa(job #733098)

Utilizator danalex97Dan H Alexandru danalex97 Data 11 aprilie 2012 14:42:07
Problema Regiuni Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.73 kb
#include <fstream>
using namespace std;

#define Ecu(a,b,c,x,y) ( a*x+b*y+c )
#define For(a,b,c) for(a=b;a<=c;++a)

typedef int Aux;

#define Nmax 211
struct Dreapta { int a;int b;int c; } Dr[Nmax];
struct Punct   { int x; int y;      } P[Nmax];

int Point[Nmax];
bool OKE[Nmax];

int Np,Nd,co;
Aux i,j;

ifstream F("regiuni.in");
ofstream G("regiuni.out");

int main()
{
	F>>Nd>>Np;
	
	For (i,1,Nd) F>>Dr[i].a>>Dr[i].b>>Dr[i].c;
	For (i,1,Np) F>>P[i].x>>P[i].y;
	
	For (i,1,Nd)
		For (j,1,Np)
			if ( Ecu( Dr[i].a, Dr[i].b, Dr[i].c, P[j].x, P[j].y ) > 0 )
				++Point[j];
	
	for (int i=1;i<=Np;++i)
		if ( !OKE[Point[i]] )
			++co,
			OKE[Point[i]]=1;
	
	G<<co<<'\n';

	F.close();
	G.close();
	return 0;
}