Where do I Turn?(叉积)
题目:
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.
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.
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).
0 0
0 1
1 1
RIGHT
-1 -1
-3 -3
-4 -4
TOWARDS
-4 -6
-3 -7
-2 -6

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?(叉积)的更多相关文章
- 【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为 ...
- Codeforces Round #140 (Div. 2)
A. Where do I Turn? 叉积判断. B. Effective Approach 记录位置. C. Flying Saucer Segments 假设有\(n\)个人,那么\(1\)要移 ...
- poj 1696 Space Ant(模拟+叉积)
Space Ant Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3840 Accepted: 2397 Descrip ...
- poj 1696 叉积理解
Space Ant Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3967 Accepted: 2489 Descrip ...
- Codeforces Round #346 (Div. 2) D. Bicycle Race 叉积
D. Bicycle Race 题目连接: http://www.codeforces.com/contest/659/problem/D Description Maria participates ...
- POJ 2318 叉积判断点与直线位置
TOYS Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom ...
- ACM/ICPC 之 计算几何入门-叉积-to left test(POJ2318-POJ2398)
POJ2318 本题需要运用to left test不断判断点处于哪个分区,并统计分区的点个数(保证点不在边界和界外),用来做叉积入门题很合适 //计算几何-叉积入门题 //Time:157Ms Me ...
- 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 ...
- webrtc进阶-信令篇-之三:信令、stun、turn、ice
webRTC支持点对点通讯,但是webRTC仍然需要服务端: . 协调通讯过程中客户端之间需要交换元数据, 如一个客户端找到另一个客户端以及通知另一个客户端开始通讯. . 需要处理NAT(网 ...
- HDU-4869 Turn the pokers
原题: Turn the pokers 思路:假设正面为0,反面为1.牌就像这样 000000....... .考虑到假如可以实现最终反面个数为m, 牌共n张, 则这n张排任取m个为反面 ...
随机推荐
- python-简单模块的使用
提示:简单模块了解掌握 @ 目录 uuid模块 calendar日历模块 time模块 datetime模块 os模块 sys模块 random模块 json和pickle模块 json pickle ...
- Java外包程序员的技术出路
学习的两个目的: 应付面试 应付工作(解决问题) 首先要明白学习的目的,不同阶段,不同技术的学习目的是不一样的. 有些技术,仅仅是应用级别的,有些技术是原理级别的(主要还是应试).所以不同技术.不同时 ...
- 【大数据-课程】高途-天翼云侯圣文-Day1:互联网大数据揭秘(大数据介绍&MR实现双十一举牌)
一.大厂职级 P7:年薪百万 二.大数据发展 1.职业路线和岗位角色 2.大数据行业发展 三.大数据的位置 1.热门行业 大数据承上启下 2.三者关系 啤酒和尿不湿:启发可以放在一块 3.大数据作用 ...
- uni框架引入外部图标
说明 在使用uni框架的uni-nav-bar自定义导航栏的时候我想要引用外部的图标,但是似乎这个好像只能引入uni框架内置的图标 所以我只能把uni的图标进行增加处理,这样引入图标的方式就和正常的引 ...
- last-child可能你也会踩的坑
旧文章从语雀迁移过来,原日期为2021-07-14 问题 当时写在写一个列表,列表每一项需要下面加下划线,最后一项不加下划线.第一时间,想到使用 :``last-child 这个伪类来实现. 当时的代 ...
- [0x12] 132.小组队列
题意 link(more:UVA540) 简化题意:对 \(n\) 个小组排队,每个小组有至多 \(m\) 个成员(每个成员有唯一编号 \(x\)),当一个人来到队伍时,如果队中有同组成员,直接插入其 ...
- day05-Vue02
Vue02 7.修饰符 7.1基本说明 修饰符(Modifiers)是以.指明的后缀,指出某个指令以特殊方式绑定 官方文档:修饰符 Vue中的修饰符有: 事件修饰符 按键修饰符 系统修饰符 事件修饰符 ...
- shell端口监听异常邮箱告警
业务场景:应用发布监听服务是否正常启动,因为服务器资源不够上不了prometheus.grafana,所以写的shell脚本监听.此脚本适用于初创公司及小微企业使用. 准备工作 除了shell脚本这里 ...
- Luogu P6394 樱花,还有你题解
原题链接:樱花,还有你 $\scr{\color{DarkOrchid}{Solution}}$ Subtask1 这是一个送分的:总和都不到$n$,无论怎么收集,花瓣数肯定不到$n$,输出impos ...
- Echarts点击多组数据多个柱子中的一个柱子,获取当前点击的是第几组数据,并获取点击的是当前组别第几根柱子,以及对应横坐标,
遇到一需求,一般都是点击图后获取其中一组数据就可以了,不需要详细到获取点击了当前X轴对应的其中的哪个, 今天的需求是 Echarts点击多组数据多个柱子中的一个柱子,获取当前点击的是第几组数据,并获取 ...