codeforces 227 A 三角形的有向面积
来源:互联网 发布:2炫装修软件 编辑:程序博客网 时间:2024/04/30 07:17
http://codeforces.com/problemset/problem/227/A
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 00 11 1
RIGHT
-1 -1-3 -3-4 -4
TOWARDS
-4 -6-3 -7-2 -6
LEFT
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:
#include <stdio.h>#include <iostream>using namespace std;double a,b,c,d,e,f;int main(){ while(~scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)) { double sum=a*d+e*b+c*f-e*d-a*f-c*b; cout << sum << endl; if(sum==0) printf("TOWARDS\n"); else if(sum<0) printf("RIGHT\n"); else printf("LEFT\n"); } return 0;}
- codeforces 227 A 三角形的有向面积
- 三角形的有向面积
- 三角形的有向面积
- 三角形的有向面积
- 三角形的有向面积公式+菜园求树问题
- 通过3点求三角形的有向面积,同时求点是否在三角形内
- 三角形有向面积 + 判断点是否在三角形内部
- 陈老师的多校联合20140816||SPOJ AMR11B 三角形的有向面积
- 5.4.3 果园里的树 // 判断点是否在圆内 三角形的有向面积,注意正负
- 如何判断一个点是否在一个多边形内部+三角形有向面积公式
- 检测两个三角形是否有重叠面积/相交的方法
- 三角形面积的勾股定理
- 三角形的面积
- 求三角形的面积
- 求三角形的面积
- 三角形的面积问题
- 求三角形的面积
- 求三角形的面积
- USCOJ 1067: 笨小猴(monkey)
- Java中的反射
- 两个for的int i重复定义
- 【自己动手写类加载器1】实现加密功能:生成加密class文件,复制到bin目录下,AppClassLoader加载出错
- new的悬挂指针可以直接赋值
- codeforces 227 A 三角形的有向面积
- C++ 二进制文件读写
- 黑马程序员之java编程基础6
- Automatic Editing
- 以嵌入式系统设计师考试成绩,开始嵌入式博客之旅
- Proxycap代理神器
- 网页重构笔试
- dbms_metadata.get_ddl
- 写点杂谈吧