-
Notifications
You must be signed in to change notification settings - Fork 0
/
10112.c
62 lines (62 loc) · 1.2 KB
/
10112.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include<stdio.h>
#include<string.h>
#include<math.h>
int loc[20][2];
char out[10];
int n;
double square(int x1,int x2,int x3,int y1,int y2,int y3)
{
return fabs(0.5*((y3 - y1)*(x2 - x1) - (y2 - y1)*(x3 - x1)));
}
int judge(int i,int j,int k,double S)
{
int ans;
double a,b,c;
for (ans=0;ans<n;ans++)
if (ans!=i && ans!=j && ans!=k)
{
a=square(loc[ans][0],loc[i][0],loc[j][0],loc[ans][1],loc[i][1],loc[j][1]);
b=square(loc[ans][0],loc[j][0],loc[k][0],loc[ans][1],loc[j][1],loc[k][1]);
c=square(loc[ans][0],loc[k][0],loc[i][0],loc[ans][1],loc[k][1],loc[i][1]);
if (fabs(a+b+c-S)<1e-6)
return 0;
}
return 1;
}
main()
{
int i,j,k,l,m;
double S,max;
/* freopen("in.txt","r",stdin);*/
while (scanf("%d",&n),n!=0)
{
getchar();
for (i=0;i<n;i++)
{
getchar();
scanf("%d%d",&loc[i][0],&loc[i][1]);
getchar();
}
max=0;
for (i=0;i<n;i++)
for (j=i+1;j<n;j++)
for (k=j+1;k<n;k++)
{
S=square(loc[i][0],loc[j][0],loc[k][0],loc[i][1],loc[j][1],loc[k][1]);
/* printf("%lf\n",S);*/
if (judge(i,j,k,S))
if (max<S)
{
max=S;
out[0]=i+'A';
out[1]=j+'A';
out[2]=k+'A';
out[3]='\0';
}
}
/* printf("\n");
printf("%lf\n",max);*/
puts(out);
}
return 0;
}