Pagini recente » Cod sursa (job #498555) | Cod sursa (job #1148989) | Cod sursa (job #2974997) | Cod sursa (job #529073) | Cod sursa (job #733100)
Cod sursa(job #733100)
#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 short Aux;
#define Nmax 1011
struct Dreapta { short a;short b;short c; } Dr[Nmax];
struct Punct { short x; short y; } P[Nmax];
short Point[Nmax];
bool OKE[Nmax];
short 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;
}