CodeForces 617D Polyline
无脑暴力判断。
#include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<queue> #include<list> #include<algorithm> using namespace std; struct point { long long x; long long y; }p1,p2,p3; int main() { scanf("%lld%lld",&p1.x,&p1.y); scanf("%lld%lld",&p2.x,&p2.y); scanf("%lld%lld",&p3.x,&p3.y); if(p1.x==p2.x&&p2.x==p3.x) printf("1\n"); else if(p1.y==p2.y&&p2.y==p3.y) printf("1\n"); else if(p1.y==p2.y&&(p3.x>=max(p1.x,p2.x)||p3.x<=min(p1.x,p2.x))) printf("2\n"); else if(p3.y==p2.y&&(p1.x>=max(p3.x,p2.x)||p1.x<=min(p3.x,p2.x))) printf("2\n"); else if(p1.y==p3.y&&(p2.x>=max(p1.x,p3.x)||p2.x<=min(p1.x,p3.x))) printf("2\n"); else if(p1.x==p2.x&&(p3.y>=max(p1.y,p2.y)||p3.y<=min(p1.y,p2.y))) printf("2\n"); else if(p3.x==p2.x&&(p1.y>=max(p3.y,p2.y)||p1.y<=min(p3.y,p2.y))) printf("2\n"); else if(p1.x==p3.x&&(p2.y>=max(p1.y,p3.y)||p2.y<=min(p1.y,p3.y))) printf("2\n"); else printf("3\n"); return 0; }