Pagini recente » Cod sursa (job #878892) | Cod sursa (job #2843693) | Cod sursa (job #1660845) | Cod sursa (job #1132244) | Cod sursa (job #1600414)
#include <fstream>
#include <map>
#include <string>
using namespace std;
ifstream fin("regiuni.in");
ofstream fout("regiuni.out");
int N, M, x, y, solution;
string binstring;
struct{
int a;
int b;
int c;
}v[1005];
map<string, char>H;
int main()
{
fin >> N >> M;
for(int i = 1; i <= M; i ++)
{
fin >> v[i].a >> v[i].b >> v[i].c;
}
for(int i = 1; i <= N; i ++)
{
fin >> x >> y;
binstring = "";
for(int j = 1; j <= M; j ++)
{
if(v[j].a*x + v[j].b*y + v[i].c < 0)
{
binstring += "0";
}
else
{
binstring += "1";
}
}
if(H[binstring] == 0)
{
solution ++;
H[binstring] = 1;
}
}
fout << solution;
return 0;
}