Pagini recente » Cod sursa (job #2653523) | Borderou de evaluare (job #20110) | Cod sursa (job #307887) | Cod sursa (job #728228) | Cod sursa (job #38905)
Cod sursa(job #38905)
#include <fstream.h>
#include <string.h>
struct dr { short a,b,c; };
dr drepte[1000];
char grupe[1000][1000],aux[1000];
int k,x,y,gas;
int n,m,i,j;
int main()
{
ifstream fin("regiuni.in");
ofstream fout("regiuni.out");
fin>>n>>m;
for (i=0;i<n;i++)
fin>>drepte[i].a>>drepte[i].b>>drepte[i].c;
for (i=0;i<m;i++)
{ fin>>x>>y;
j=0;
while (aux[j]) aux[j++]=0;
for (j=0;j<n;j++)
if (drepte[j].a*x+drepte[j].b*y+drepte[j].c>0)
strcat(aux,"1");
else
strcat(aux,"0");
gas=0;
for (j=0;j<k;j++)
if (strcmp(aux,grupe[j])==0)
{gas=1;
break;
}
if (gas==0)
strcpy(grupe[k++],aux);
}
fout<<k<<'\n';
return 0;
}