Cod sursa(job #38622)

Utilizator skyelHighScore skyel Data 25 martie 2007 22:19:43
Problema Regiuni Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.04 kb
#include<string.h>
#include<fstream.h>
#define input "regiuni.in"
#define output "regiuni.out"
#define Nmax 1005
#define Mmax 1005
#define mod 666013
//using namespace std;
char sec[Mmax][Mmax];


int main()
	{
	ifstream fin(input);
	ofstream fout(output);
	int i,j,k=1,s,ok,t;
   long n,m,a[Mmax],b[Mmax],c[Mmax],dx[Nmax],dy[Nmax],h;
	fin>>n>>m;
	k=0;
	for(i=0;i<n;i++)
		fin>>a[i]>>b[i]>>c[i];
	for(i=0;i<m;i++)
		fin>>dx[i]>>dy[i];
	h=0;
   for(i=0;i<m;i++,h++)
		{
	
		for(j=0;j<n;j++)
			{
			s=dx[i]*a[j]+dy[i]*b[j]+c[j];
			if(a[j]*b[j]!=0)
				{
				if(s>0)
					sec[h][j]='1';
				else
				    sec[h][j]='0';
            }
			else
				{
				if(s<0)
					sec[h][j]='1';
				else
				    sec[h][j]='0';
				}
			}
      ok=1;
      for (t=0;t<h;t++)
          {
          if (!strcmp(sec[h],sec[t]))
             {
             ok=0;
             h--;
             break;
             }
          }     
      if (ok)
         k++;                        
      }
	fout<<k<<"\n";
	return 0;
	}