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; }
相关文章推荐
- Codeforce#181 div2 C,E--problem 300E,300C
- codeforce 386(abcd)水题
- codeforce 18B
- CodeForce Round #186 Div.2
- codeforce round A. Binary Protocol
- Codeforce 893C Rumor (dfs)
- codeforce.Vladik and flights
- codeforce 6C - Alice, Bob and Chocolate
- Codeforce 题目337 C. Harmony Analysis(递归)
- codeforce-B. Sort the Array
- codeforce 192 div2解题报告
- Codeforce 712A Memory and Crow
- codeforce 455A—— DP—— Boredom
- codeforce 766D Mahmoud and a Dictionary 带权并查集
- codeforce 417D Cunning Gena (状压DP)
- codeforce-【B. Alice, Bob, Two Teams】
- Codeforce_828C_String Reconstruction_字符串处理
- codeforce_Diplomas and Certificates_水
- codeforce #200 div2 的水题三道
- codeforce Amr and The Large Array