题目:

Trouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents of the surrounding villages.

A brave hero decided to put an end to the dragon. He moved from point A to fight with Gorynych. The hero rode from point A along a straight road and met point B on his way. The hero knows that in this land for every pair of roads it is true that they are either parallel to each other, or lie on a straight line, or are perpendicular to each other. He also knows well that points B and C are connected by a road. So the hero must either turn 90 degrees to the left or continue riding straight ahead or turn 90 degrees to the right. But he forgot where the point C is located.

Fortunately, a Brave Falcon flew right by. It can see all three points from the sky. The hero asked him what way to go to get to the dragon's lair.

If you have not got it, you are the falcon. Help the hero and tell him how to get him to point C: turn left, go straight or turn right.

At this moment the hero is believed to stand at point B, turning his back to point A.

Input

The first input line contains two space-separated integers xa, ya (|xa|, |ya| ≤ 109) — the coordinates of point A. The second line contains the coordinates of point B in the same form, the third line contains the coordinates of point C.

It is guaranteed that all points are pairwise different. It is also guaranteed that either point B lies on segment AC, or angle ABC is right.

Output

Print a single line. If a hero must turn left, print "LEFT" (without the quotes); If he must go straight ahead, print "TOWARDS" (without the quotes); if he should turn right, print "RIGHT" (without the quotes).

input
0 0
0 1
1 1
output
RIGHT
input
-1 -1
-3 -3
-4 -4
output
TOWARDS
input
-4 -6
-3 -7
-2 -6
 output
   LEFT
题意:有三个点A、B、C,给出他们坐标,从A走到B再到C,让你判断位于B点时,想要到C点是左转、右转还是直走。
用向量的叉积来做,还是挺简单的。

 1 #include <map>
2 #include <stack>
3 #include <queue>
4 #include <cmath>
5 #include <string>
6 #include <limits>
7 #include <cstdio>
8 #include <cstdlib>
9 #include <cstring>
10 #include <iostream>
11 #include <algorithm>
12 #define Scc(c) scanf("%c",&c)
13 #define Scs(s) scanf("%s",s)
14 #define Sci(x) scanf("%d",&x)
15 #define Sci2(x, y) scanf("%d%d",&x,&y)
16 #define Sci3(x, y, z) scanf("%d%d%d",&x,&y,&z)
17 #define Scl(x) scanf("%I64d",&x)
18 #define Scl2(x, y) scanf("%I64d%I64d",&x,&y)
19 #define Scl3(x, y, z) scanf("%I64d%I64d%I64d",&x,&y,&z)
20 #define Pri(x) printf("%d\n",x)
21 #define Prl(x) printf("%I64d\n",x)
22 #define Prc(c) printf("%c\n",c)
23 #define Prs(s) printf("%s\n",s)
24 #define For(i,x,y) for(int i=x;i<y;i++)
25 #define For_(i,x,y) for(int i=x;i<=y;i++)
26 #define FFor(i,x,y) for(int i=x;i>y;i--)
27 #define FFor_(i,x,y) for(int i=x;i>=y;i--)
28 #define Mem(f, x) memset(f,x,sizeof(f))
29 #define LL long long
30 #define ULL unsigned long long
31 #define MAXSIZE 1005
32 #define INF 0x3f3f3f3f
33 const int mod=1e9+7;
34 const double PI = acos(-1.0);
35
36 using namespace std;
37
38 int main()
39 {
40 LL x1,y1,x2,x3,y2,y3;
41 Scl2(x1,y1);
42 Scl2(x2,y2);
43 Scl2(x3,y3);
44 x1=x2-x1;
45 y1=y2-y1;
46 x2=x3-x2;
47 y2=y3-y2;
48 if(x1*y2-x2*y1>0)
49 Prs("LEFT");
50 else
51 if(x1*y2-x2*y1==0)
52 Prs("TOWARDS");
53 else
54 Prs("RIGHT");
55 return 0;
56 }

Where do I Turn?(叉积)的更多相关文章

  1. 【CodeForces 227A】Where do I Turn?叉积

    题意 ABC的位置关系只有三种可能: 1.在一条直线上,输出TOWARDS A--B--C 2.AB 和BC垂直,B为直角顶点,AB左侧是C,输出LEFT C--B | A 3.AB 和BC垂直,B为 ...

  2. Codeforces Round #140 (Div. 2)

    A. Where do I Turn? 叉积判断. B. Effective Approach 记录位置. C. Flying Saucer Segments 假设有\(n\)个人,那么\(1\)要移 ...

  3. poj 1696 Space Ant(模拟+叉积)

    Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3840   Accepted: 2397 Descrip ...

  4. poj 1696 叉积理解

    Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3967   Accepted: 2489 Descrip ...

  5. Codeforces Round #346 (Div. 2) D. Bicycle Race 叉积

    D. Bicycle Race 题目连接: http://www.codeforces.com/contest/659/problem/D Description Maria participates ...

  6. POJ 2318 叉积判断点与直线位置

    TOYS   Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom ...

  7. ACM/ICPC 之 计算几何入门-叉积-to left test(POJ2318-POJ2398)

    POJ2318 本题需要运用to left test不断判断点处于哪个分区,并统计分区的点个数(保证点不在边界和界外),用来做叉积入门题很合适 //计算几何-叉积入门题 //Time:157Ms Me ...

  8. Lesson 11 One good turn deserves another

    Text I was having dinner at a restaurant when Tony Steele came in. Tony worked in a layer's office y ...

  9. webrtc进阶-信令篇-之三:信令、stun、turn、ice

    webRTC支持点对点通讯,但是webRTC仍然需要服务端:  . 协调通讯过程中客户端之间需要交换元数据,    如一个客户端找到另一个客户端以及通知另一个客户端开始通讯.  . 需要处理NAT(网 ...

  10. HDU-4869 Turn the pokers

    原题:  Turn the pokers       思路:假设正面为0,反面为1.牌就像这样 000000....... .考虑到假如可以实现最终反面个数为m, 牌共n张, 则这n张排任取m个为反面 ...

随机推荐

  1. WEB入门——信息搜集1-20

    WEB1--查看源码 查看源码即可得flag. WEB2--JS前端禁用 查看源码即可得flag. JavaScript实现禁用的方法简单来说就是当用户使用键盘执行某一命令是返回的一种状态,而这种状态 ...

  2. linux学习相关资料整理

    linux常用指令记录 Python3.9.9安装 supervisor安装与监控nginx 使用supervisor监控mysql supervisor监控tomcat配置文件 nginx-1.22 ...

  3. Java实现Excel批量导入数据库

    场景说明 在实际开发中,经常需要解析Excel数据来插入数据库,而且通常会有一些要求,比如:全部校验成功才入库.校验成功入库,校验失败返回提示(总数.成功数.失败数.失败每行明细.导出失败文件明细-) ...

  4. 浏览器DevTools使用技巧

    我们是袋鼠云数栈 UED 团队,致力于打造优秀的一站式数据中台产品.我们始终保持工匠精神,探索前端道路,为社区积累并传播经验价值. 本文作者:正则 作为一名前端开发人员,平时开发中使用最多的就是 Ch ...

  5. xxl-job定时调度任务Java代码分析

    简介 用xxl-job做后台任务管理, 主要是快速解决定时任务的HA问题, 项目代码量不大, 功能精简, 没有特殊依赖. 因为产品中用到了这个项目, 上午花了点时间研究了一下运行机制. 把看到的记一下 ...

  6. Python免杀过360

    本文章仅供参考学习 作者:mantou 博客地址:https://www.cnblogs.com/mantou0/ 分离免杀 这个我就不多说了,效果确实不错,网上关于分离免杀的也有很多文章 不分离过3 ...

  7. [python]《Python编程快速上手:让繁琐工作自动化》学习笔记5

    1. 处理CSV文件笔记(第14章) (代码下载) 本文主要在python下介绍CSV文件,CSV 表示"Comma-Separated Values(逗号分隔的值)",CSV文件 ...

  8. [机器学习] Yellowbrick使用笔记5-回归可视化

    回归模型试图预测连续空间中的目标.回归计分可视化工具显示模型空间中的实例,以便更好地理解模型是如何进行预测的.代码下载 Yellowbrick已经实施了三种回归评估: 残差图Residuals Plo ...

  9. 一文读懂 Kubernetes 存储设计

    在 Docker 的设计中,容器内的文件是临时存放的,并且随着容器的删除,容器内部的数据也会一同被清空.不过,我们可以通过在 docker run 启动容器时,使用 --volume/-v 参数来指定 ...

  10. 华为云发布冷启动加速解决方案:助力Serverless计算速度提升90%+

    摘要:本文介绍了华为云对冷启动优化这一业界难题的探索之路,创新提出了基于进程级快照的优化方案. 作者信息-- 子游:华为元戎高级工程师 平山:华为云中间件 Serverless 负责人 琪君:华为元戎 ...