思路:枚举一下就好啦
#include<stdio.h>
#include<math.h>
struct list
{
int x,y;
}map[20];
double s_get(struct list a, struct list b,struct list c)
{
return fabs(0.5*((c.y-a.y)*(b.x-a.x)-(b.y-a.y)*(c.x-a.x)));
}//得出三个点构成的三角形的面积
int cha(struct list a,struct list b,struct list c,struct list d)
{
return s_get(a,b,c) == s_get(a,b,d)+s_get(a,c,d)+s_get(b,c,d);
}//判断点是不是在三角形的内部。
int main()
{
int n;
char c[100];
int x,y,z;
while(scanf("%d%*c",&n)&&n)
{
double m=-1.0;
int i,j,k;
for(i=0;i<n;i++)
{
scanf("%c%d%d%*c",&c[i],&map[i].x,&map[i].y);
}
for(i=0;i<n;i++)//一次枚举
{
for(j=i+1;j<n;j++)
{
for(k=j+1;k<n;k++)
{
int flag=1,p;
for(p=0;p<n;p++)
{
if(p==k||p==i||p==j)continue;
if(cha(map[i],map[j],map[k],map[p]))
{
flag=0;
break;
}
}
if(flag&&m<s_get(map[i],map[j],map[k]))
{
m=s_get(map[i],map[j],map[k]);
x=i;
y=j;
z=k;
}
}
}
}
printf("%c%c%c\n",65+x,65+y,65+z);
}
return 0;
}