【CodeForces - 227A】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.

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 Bin 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).

Examples

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

Note

The picture to the first sample:

The red color shows points A, B and C. The blue arrow shows the hero's direction. The green color shows the hero's trajectory.

The picture to the second sample:

题目大意:

   让你由A点通过B点走到C点,现在已知你在B点(背向A点),问你要走到C点需要往直走还是左拐还是右拐、、

解题报告:

  做个叉积就可以了、、、不解释了、、(其实题干都不用读,,直接看样例和HINT猜代码就好了、、)

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
ll xa,xb,xc,ya,yb,yc;
int main()
{cin>>xa>>ya;cin>>xb>>yb;cin>>xc>>yc;ll x1,x2,y1,y2;x1=(xb-xa);y1=(yb-ya);x2=(xc-xb);y2=(yc-yb);if(x1*y2-x2*y1>0) puts("LEFT");else if(x1*y2-x2*y1==0) puts("TOWARDS");else puts("RIGHT");return 0 ;}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441299.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux内核镜像sd卡,【原创】Linux QT镜像的制作--制作SD卡启动盘

最近买了个新的开发板&#xff0c;原生的是Android操作系统&#xff0c;需要自己少个启动盘&#xff0c;制作LinuxQT操作系统。新的开发板带这个制作的源文件&#xff0c;要先把这个文件拷贝到虚拟机Ubunbtu的共享目录下。打开share文件下显示文件如下&#xff1a;打开文件夹命…

【CodeForces - 227C】Flying Saucer Segments (思维)

题干&#xff1a; An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives dont even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. …

清楚linux缓存文件,Linux删除文件 清除缓存

相信很多测试 经常会经历开发叫你清除缓存这种事。那我们要怎么清呢&#xff1f;一、首先&#xff0c;确认你要清除的缓存在哪个目录下&#xff0c;然后切换到该目录下&#xff0c;比如 我现在知道我的的缓存目录是在newerp这个目录下&#xff0c;则如图二、然后 执行命令 rm -…

win10 linux安卓模拟器,genymotion安卓模拟器在Window10中使用的问题

最近一段时间&#xff0c;把系统升级到了win10&#xff0c;然后悲催的事情出现了&#xff0c;genymotion挂了&#xff0c;根本就不能启动&#xff0c;而且还是2.6版本的genymotion&#xff0c;下面我把遇到的问题总结一下&#xff1a;首先&#xff0c;在我的win10系统中&#x…

cross_compile = arm-linux-,cross compile grpc for arm

8种机械键盘轴体对比本人程序员&#xff0c;要买一个写代码的键盘&#xff0c;请问红轴和茶轴怎么选&#xff1f;This post will tell you how to cross compile gPRC static lib for ARM.前段时间尝试交叉编译gRPC遇到了不少的麻烦&#xff0c;写篇post记录一下。gRPCPreparat…

linux键盘映射默认,Linux 中的键盘映射

前面提到&#xff0c;X Window 直接处理了键盘的输入输出端口&#xff0c;因此&#xff0c;在 Linux 虚拟控制台下和 X Window 下使用不同的键盘映射方法。在 Lin对于英语来说&#xff0c;键盘上的字母键直接和英语字母表中的字母对应&#xff0c;但是对于非英语的语种来说&…

C语言用字符串sex储存,2005年计算机等级考试二级C语言全真标准预测试卷(2)

一、选择题(1&#xff5e;40题每题1分&#xff0c;41&#xff5e;50题每题2分&#xff0c;共60分)1.微型计算机的运算器、控制器及内存储器组合在一起&#xff0c;称之为()(本题分值&#xff1a;1分)A.ALUB.CPUC.MPUD.主机【正确答案】D2.下列存储器中&#xff0c;存取速度最快…

c语言全局变量SQR,c语言a/=SQR(k+m);是什么意思?

满意答案NightmareJJ2013.03.16采纳率&#xff1a;47% 等级&#xff1a;12已帮助&#xff1a;11233人先看第一个main() // 主函数{printf("%ld\n", fun(3));} //输出fun(3)这个函数的返回值&#xff0c;3就是下一个//函数中的n 值。long fun (int n) //定义fun函数…

【POJ - 1850】Code (组合数学,字符串另类排序)

题干&#xff1a; Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequence. It is considered that …

c语言蓝牙接收6,终于搞定了通过两路蓝牙接收数据

一直想做无线传感器&#xff0c;通过蓝牙来接收数据&#xff0c;无奈因为arduino接收串口数据的一些问题&#xff0c;一直搁到现在。因为学校里给学生开了选修课&#xff0c;所以手边有一些nano和mega可以使用&#xff0c;所以就做了用两个nano加上两个蓝牙模块来发射数据&…

【POJ - 1942 】Paths on a Grid (组合数学,求组合数的无数种方法)

题干&#xff1a; Imagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time hes explaining that (ab) 2a 22abb 2). So you decide to waste your time with d…

兔子吃萝卜的c语言编程,狼追兔子的c语言实现

满意答案16guoyuming2013.03.05采纳率&#xff1a;49% 等级&#xff1a;13已帮助&#xff1a;8005人用单链表实现#include #includetypedef struct node{int cave;struct node * next;}node,*LinkList;void main(){int i0,j,count1; // 初始值为1&#xff1b;LinkList L,p,h…

android 动态换肤框架,GitHub - ss520k/Android-Skin-Loader: 一个通过动态加载本地皮肤包进行换肤的皮肤框架...

Android-Skin-Loader更新日志导入到Android Studio&#xff0c;使用gradle构建皮肤包(见7. 皮肤包是什么&#xff1f;如何生成&#xff1f;)(2015-12-02)解决Fragment换肤在某些版本的support-v4包下失效的问题(感谢javake同学)(2015-12-02)对textColor加入selector类型的资源的…

android吸附菜单,Android仿微博、人人Feed详情页吸附导航栏

仿微博、人人的feed详情页面&#xff1a;Listview上下滑动&#xff0c;导航栏view可吸附在顶部的效果。一、实现效果上图&#xff1a;效果图.gif欢迎拍砖&#xff0c;拍拍更进步。没有对比&#xff0c;怎么会有伤害&#xff0c;下面是 微博、人人的Feed详情页&#xff1a;微博、…

android 居右属性,使用layoutDirection属性设置布局靠左或靠右

通过设置layoutDirection属性值为mx.core.LayoutDirection.RTL(右到左)或mx.core.LayoutDirection.LTR(左到右)&#xff0c;使布局为靠左或靠右(如下图)。该属性可设置3种值&#xff0c;LayoutDirection.RTL、LayoutDirection.LTR和null(ILayoutDirectionElement时)/undefined(…

html表格全屏显示,tableView滑动全屏显示

今天要分享的一个效果是在一个页面弹出视图展示一个tableview&#xff0c;然后手指滑动tableview时&#xff0c;视图随着tableview偏移量增加而慢慢增加&#xff0c;到达临界时&#xff0c;全屏显示&#xff0c;然后再次向下滑动时&#xff0c;当偏移量到达临界点&#xff0c;视…

大量html乱码seo,HTTPS改造之后网页错位乱码,影响SEO和正常访问,应该这样改

有一些朋友可能不太知道https改造怎么做&#xff0c;就学着网站的步骤进行&#xff0c;实际操作过程中可能会遇到很多问题。比如说有的会出现网页错位、页面乱码、后台功能无法使用的情况。昨天我们就有一个客户他自己做了https改造&#xff0c;但是造成后台无法上传图片的情况…

微型计算机中最小的单位,微型计算机中最小的数据单位是

微型计算机中最小的数据单位是比特。微型计算机&#xff0c;是指由微处理器作为CPU的计算机。由大规模集成电路组成的、体积较小的电子计算机。由微处理机(核心)、存储片、输入和输出片、系统总线等组成。特点是体积小、灵活性大、价格便宜、使用方便。这类计算机的普遍特征就是…

琴生不等式一般形式_001.二次函数、方程和不等式知识点

学法指导&#xff1a;本专题讲授不等式内容&#xff0c;这部分内容是学生的难点&#xff0c;为此有几点说明&#xff1a;1.把握好学习的难度。按教材内不等式部分展现的内容看&#xff0c;它很简单&#xff0c;但学过的知道&#xff0c;这部分内容很难&#xff0c;直白的讲&…

伺服电机停的时候会冲一下_造成伺服电机抖动的原因竟然是它!内附解决方法...

伺服电机(servo motor )是指在伺服系统中控制机械元件运转的发动机&#xff0c;是一种补助马达间接变速装置。它可使控制速度&#xff0c;位置精度非常准确&#xff0c;可以将电压信号转化为转矩和转速以驱动控制对象。伺服电机转子转速受输入信号控制&#xff0c;并能快速反应…