您的位置:首页 > 其它

codeforce499C - Crazy Town

2014-12-25 15:22 204 查看
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
#include<string>
#include<map>
#define LL long long
using namespace std;
const int maxn = 310;
LL n,x,m;
int sum1[maxn],sum2[maxn];
struct node
{
    LL x,y;
} c[maxn];
struct u
{
    LL a,b,c;
} u[maxn];
int pan(LL a,LL b,LL c,LL x,LL y)
{
    if(a*x+b*y+c>0)
        return 1;
    else
        return -1;
}
int main()
{
    for(int i=0; i<2; i++)
    {
        cin>>c[i].x>>c[i].y;
    }
    scanf("%I64d",&m);
    for(int i=0; i<m; i++)
    {
        cin>>u[i].a>>u[i].b>>u[i].c;
    }

    for(int i=0; i<m; i++)
    {
      int o1=pan(u[i].a,u[i].b,u[i].c,c[0].x,c[0].y);
            sum1[i]=o1;
        int o2=pan(u[i].a,u[i].b,u[i].c,c[1].x,c[1].y);
            sum2[i]=o2;
    }
    int cnt=0;
   for(int i=0; i<m; i++)
   {
       if(sum1[i]!=sum2[i])
        cnt++;
   }
   printf("%d\n",cnt);
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: