# HDOJ2108：Shape of HDU

Problem Description

Input

Output

Sample Input
4
0 0 1 0 1 1 0 1
0

Sample Output
convex

sqrt函数中形参必须为double，但double不能用^2进行乘方，降低了代码可读性。

```#include
#include
#include
int main()
{
int  flag,n,ni;
double a, b, c,cc,arc;
double num[2][10000];
while(~scanf("%d", &n)&&n!=0)
{
memset(num, 0, sizeof(num));
flag = 0;
for (ni = 0; ni < n; ni++)
{
scanf("%lf%lf", &num[0][ni], &num[1][ni]);
}
for (ni = 2; ni < n; ni++)
{
a = sqrt((num[0][ni - 2] - num[0][ni - 1])*(num[0][ni - 2] - num[0][ni - 1]) + (num[1][ni - 2] - num[1][ni - 1])*(num[1][ni - 2] - num[1][ni - 1]));
b = sqrt((num[0][ni - 1] - num[0][ni])*(num[0][ni - 1] - num[0][ni]) + (num[1][ni - 1] - num[1][ni])*(num[1][ni - 1] - num[1][ni]));
c = sqrt((num[0][ni - 2] - num[0][ni])*(num[0][ni - 2] - num[0][ni]) + (num[1][ni - 2] - num[1][ni])*(num[1][ni - 2] - num[1][ni]));
cc = (a*a + b*b - c*c) / (2 * a*b);
arc = acos(cc) * 180 / 3.1415926;
if (arc>(double)180||arc<(double)0)
{
flag = 1;
}
}
a = sqrt((num[0][ni] - num[0][0])*(num[0][ni] - num[0][0]) + (num[1][ni] - num[1][0])*(num[1][ni] - num[1][0]));
b = sqrt((num[0][0] - num[0][1])*(num[0][0] - num[0][1]) + (num[1][0] - num[1][1])*(num[1][0] - num[1][1]));
c = sqrt((num[0][ni] - num[0][1])*(num[0][ni] - num[0][1]) + (num[1][ni] - num[1][1])*(num[1][ni] - num[1][1]));
cc = (a*a + b*b - c*c) / (2 * a*b);
arc = acos(cc) * 180 / 3.1415926;
if (arc>(double)180 || arc<(double)0)
{
flag = 1;
}
if (flag = 0)
{
printf("convexn");
}
if (flag = 1)
{
printf("concaven");
}
}
return 0;
}
```

```#include
#include
struct xy
{
int x;
int y;
};
typedef struct xy xy;
int main()
{
xy num[10001],d,z;
int a, b, c, cc, n, ni;
int flag;
while (~scanf("%d",&n)&&n!=0)
{
flag = 0;
for (ni = 0; ni
```