poj1696Space Ant(入门凸包)

题目链接:

http://poj.org/problem?id=1696

这道题直接就是凸包模板了。。我用的卷包裹法

AC代码:

#include
#include
#include
#include
using namespace std;
#define inf 9999999
struct point
{
    int x,y;
};
point p[55];
//叉积计算
int det(int x1,int y1,int x2,int y2)
{
    return x1*y2-x2*y1;
}
int cross(point A,point B,point C,point D)
{
    return det(B.x-A.x,B.y-A.y,D.x-C.x,D.y-C.y);
}
int dist(point A,point B)
{
    return(B.x-A.x)*(B.x-A.x)+(B.y-A.y)*(B.y-A.y);
}
int main()
{
    int m,n,num;
    int k,s,tot;
    int minx,miny,vis[55];
    scanf("%d",&m);
    int conbag[55];
    while(m--)
    {
        minx=inf;
        miny=inf;
        memset(vis,0,sizeof(vis));
        memset(conbag,0,sizeof(conbag));
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d%d",&num,&p[i].x,&p[i].y);
            if(p[i].y


你可能感兴趣的:(计算几何)