传送门:
http://codeforces.com/contest/617/problem/D
shab分类讨论题
2的情况:
根据四个端点(最左最右最上最下)去判断可否三个点均在边界上。。。
#include<bits/stdc++.h>
using namespace std;
const int INF=2e9;
pair<int,int>p[3];
bool ck(int xx,int yy)
{
for(int i=0;i<3;i++)
if(p[i].first!=xx&&p[i].second!=yy)
return false;
return true;
}
int main()
{
int nx=INF,xx=-1*INF,ny=INF,xy=-1*INF;
for(int i=0;i<3;i++)
{
int a,b;
cin>>a>>b;
p[i]=make_pair(a,b);
nx=min(a,nx);
ny=min(b,ny);
xx=max(a,xx);
xy=max(b,xy);
}
if(nx==xx || xy==ny)
cout<<1;
else if(ck(nx,ny)||ck(nx,xy)||ck(xx,ny)||ck(xx,xy))
cout<<2;
else
cout<<3;
return 0;
}