codeforce 851 B Arpa and an exam about geometry(思路)
来源:互联网 发布:如何下载excel2010软件 编辑:程序博客网 时间:2024/06/06 04:19
B. Arpa and an exam about geometry
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Arpa is taking a geometry exam. Here is the last problem of the exam.
You are given three points a, b, c.
Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.
Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not.
Input
The only line contains six integers ax, ay, bx, by, cx, cy (|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 109). It’s guaranteed that the points are distinct.
Output
Print “Yes” if the problem has a solution, “No” otherwise.
You can print each letter in any case (upper or lower).
Examples
input
0 1 1 1 1 0
output
Yes
input
1 1 0 0 1000 1000
output
No
Note
In the first sample test, rotate the page around (0.5, 0.5) by .
In the second sample test, you can’t find any solution.
题意:给出a,b,c三个点,问是否存在一点,以此点旋转相同的角度,a可以到达b,b可以到达c
分析得 ab=bc,且abc都不在一条线上满足条件
计算abc不在一条线,则计算 ab斜率!=bc斜率,考虑一下除0的情况
#include<bits/stdc++.h>using namespace std;typedef long long LL;LL solve(LL ax,LL ay,LL bx,LL by){ return (ax-bx)*(ax-bx)+(ay-by)*(ay-by);}bool check(LL ax,LL ay,LL bx,LL by,LL cx,LL cy){ return (by-ay)*(cx-bx)==(bx-ax)*(cy-by);}int main(){ LL ax,ay,bx,by,cx,cy; scanf("%lld%lld%lld%lld%lld%lld",&ax,&ay,&bx,&by,&cx,&cy); if(solve(ax,ay,bx,by)==solve(bx,by,cx,cy)) { if(check(ax,ay,bx,by,cx,cy)) printf("No\n"); else printf("Yes\n"); } else printf("No\n");}
- codeforce 851 B Arpa and an exam about geometry(思路)
- B. Arpa and an exam about geometry
- codeforces 851B Arpa and an exam about geometry
- codeforces 851 B. Arpa and an exam about geometry
- Codeforces 851 B Arpa and an exam about geometry
- Codeforces Round #432 B. Arpa and an exam about geometry
- Codeforces Round#432 B. Arpa and an exam about geometry
- Codeforces Round #432 B. Arpa and an exam about geometry
- Div#432B Arpa and an exam about geometry
- Codeforces 851B && Round #432 Div. 2 B. Arpa and an exam about geometry
- Codeforces 851B. Arpa and an exam about geometry 计算几何,结论题
- Codeforces Round #432 Div2 B. Arpa and an exam about geometry
- codeforces Div#432 B Arpa and an exam about geometry(技巧)
- Codeforces Round #432 (Div. 2) B Arpa and an exam about geometry
- Codeforces Round #432 (Div. 2) B. Arpa and an exam about geometry(数学水题)
- B. Before an Exam
- B - Before an Exam
- codeforce 741 B. Arpa's weak amphitheater and Mehrdad's valuable Hoses(背包 dp)
- HDU
- collect2.exe: error
- 推荐系统(1)——推荐系统概述
- HDU 1010Tempter of the Bone(dfs+剪枝)
- Game Prediction POJ
- codeforce 851 B Arpa and an exam about geometry(思路)
- 初识rabbitmq
- Junit4测试Service中的方法
- SIFT,SURF,ORB,FAST 特征提取算法比较
- LeetCode——104. Maximum Depth of Binary Tree
- 【CUGBACM15级BC第31场 B】hdu 5179 beautiful number
- 简历制作
- 提出一种数据结构支持push和pop操作以及第三种操作findMin,返回最小值,所有操作均以O(1)最坏时间运行
- 模拟JVM内存溢出