#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstring>
#include<vector>
#include<list>
#include<bitset>
#include<set>
#include<map>
#include<time.h>
using namespace std;
#define LL long long
#define pi (4*atan(1.0))
#define eps 1e-8
#define bug(x) cout<<"bug"<<x<<endl;
const int N=1e5+10,M=1e6+10,inf=1e9+10;
const LL INF=1e18+10,mod=1e9+7;
int sgn(double x)
{
if(fabs(x) < eps)return 0;
if(x < 0)return -1;
else return 1;
}
struct Point
{
double x,y;
Point() {}
Point(double _x,double _y)
{
x = _x;
y = _y;
}
Point operator -(const Point &b)const
{
return Point(x - b.x,y - b.y);
}
//叉积
double operator ^(const Point &b)const
{
return x*b.y - y*b.x;
}
//点积
double operator *(const Point &b)const
{
return x*b.x + y*b.y;
}
//绕原点旋转角度B(弧度值),后x,y的变化
void transXY(double B)
{
double tx = x,ty = y;
x= tx*cos(B) - ty*sin(B);
y= tx*sin(B) + ty*cos(B);
}
};
Point p[N];
bool isconvex(Point poly[],int n)
{
bool s[3];
memset(s,false,sizeof(s));
for(int i = 0; i < n; i++)
{
s[sgn( (poly[(i+1)%n]-poly[i])^(poly[(i+2)%n]-poly[i]) )+1] = true;
if(s[0] && s[2])return false;
}
return true;
}
int main ()
{
int n;
while(~scanf ( "%d", &n ) )
{
if(!n)break;
for(int i=0; i<n; i++)
scanf ( "%lf%lf", &p[i].x, &p[i].y );
if(isconvex(p,n))printf("convex\n");
else printf("concave\n");
}
return 0 ;
}
来源: http://www.bubuko.com/infodetail-2278132.html