判断是否共线用map记录下斜率;<??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHByZSBjbGFzcz0="brush:java;">#include #include #include #include #include #include #include using namespace std; #define N 1022 const int INF = 1<<30-1; bool vis[2020]; int mat[1022][1022],lowcost[1022],pre[1033]; double cost[1022][1022]; int maxlong,star,end; double mathh(int a,int c,int b,int d) { return sqrt((a-b)*(a-b)*1.0+(c-d)*(c-d)*1.0); } double xielv(int a,int c,int b,int d) { if(a==b)//垂直x轴 return INF; else return (d-c)*1.0/(b-a); } struct node { int x,y; } point[1022]; bool cmp(node a,node b) { if(a.x==b.x) return a.y m; m.clear(); for(int j=i+1; j