传送门:http://codeforces.com/problemset/problem/227/A
就是给出来的点,当前的点,要去的点,判断向前还是向左还是向右
水题,叉积好了
代码如下:
#include<cstdio>
using namespace std;
long long xa,ya,xb,yb,xc,yc;
int main()
{
scanf("%I64d%I64d",&xa,&ya);
scanf("%I64d%I64d",&xb,&yb);
scanf("%I64d%I64d",&xc,&yc);
if ((xa-xb)*(yb-yc)-(xb-xc)*(ya-yb)==0)
{
printf("TOWARDS\n");
}
if ((xa-xb)*(yb-yc)-(xb-xc)*(ya-yb)>0)
{
printf("LEFT\n");
}
if ((xa-xb)*(yb-yc)-(xb-xc)*(ya-yb)<0)
{
printf("RIGHT\n");
}
return 0;
}