
题目链接:http://lightoj.com/volume_showproblem.php?problem=1018
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std; const int maxe = ;
const int maxn = ;
const int INF = 0x3f3f3f;
int X[maxn],Y[maxn];
int S[maxn][maxn];
int T,N;
int dp[<<maxn];
int a[<<maxn]; int Cross(int x1,int y1,int x2,int y2){
return x1*y2 - y1 * x2;
}
void init(){
for(int i=;i<maxn;i++) a[<<i]=i;
}
int dfs(int x){ //求点集S。
if(dp[x]!=-) return dp[x];
int i=a[x&-x]; //点集S的最低位上的点。
dp[x]=INF;
for(int k=x-(x&-x);k;k-=k&-k){ //S-(S&-S)是去除i后的点集。
int j=a[k&(-k)];
dp[x]=min(dp[x],dfs(x^(S[i][j]&x))+);
}
return dp[x];
}
int main()
{
//freopen("E:\\acm\\input.txt","r",stdin); init();
cin>>T;
for(int cas=;cas<=T;cas++){
scanf("%d",&N);
for(int i=;i<N;i++) scanf("%d %d",&X[i],&Y[i]); memset(S,,sizeof(S));
for(int i=;i<N;i++)
for(int j=i+;j<N;j++){
for(int k=;k<N;k++){
if(!Cross(X[j]-X[i],Y[j]-Y[i],X[k]-X[i],Y[k]-Y[i]))
S[i][j] |= (<<k); //i,j所在直线上其他点的集合。
}
S[j][i] = S[i][j];
}
int ALL = (<<N)-;
memset(dp,-,sizeof(dp));
dp[] = ;
for(int i=;i<N;i++) dp[<<i] = ;
printf("Case %d: %d\n",cas,dfs(ALL));
}
}