日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【CodeForces - 227A】Where do I Turn? (计算几何,叉积判断直线拐向)

發布時間:2023/12/10 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【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 ;}

?

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的【CodeForces - 227A】Where do I Turn? (计算几何,叉积判断直线拐向)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。