Codeforces Round #432 (Div. 2) B. Arpa and an exam about geometry(数学水题)
2017-09-04 23:28
609 查看
B. Arpa and an exam about geometry
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard 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
output
input
output
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.
题解:
比赛还在进行但是我已经写不动了,10分钟过a题(太水不想写题解),20分钟过b题。。c题看不懂,d题不会做,e题。。。算了吧,虽然这题很水但还是水一发博客
题意:
给你3个点的坐标,问你是否能找到一个点,以该点为中心旋转一定的角度使得a与b重合,b与c重合
思路:
直接判断只要两个线段长度相同而且三个点不在同一直线上就行了
ps:
这题之前用double型40组数据出错估计是因为double精度不够,还有就是斜率不存在的时候会出问题,把数据类型改成long long,把斜率判等写成乘法就好了
暂时ac的代码:
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard 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.
题解:
比赛还在进行但是我已经写不动了,10分钟过a题(太水不想写题解),20分钟过b题。。c题看不懂,d题不会做,e题。。。算了吧,虽然这题很水但还是水一发博客
题意:
给你3个点的坐标,问你是否能找到一个点,以该点为中心旋转一定的角度使得a与b重合,b与c重合
思路:
直接判断只要两个线段长度相同而且三个点不在同一直线上就行了
ps:
这题之前用double型40组数据出错估计是因为double精度不够,还有就是斜率不存在的时候会出问题,把数据类型改成long long,把斜率判等写成乘法就好了
暂时ac的代码:
#include<iostream> #include<cstring> #include<stdio.h> #include<math.h> #include<string> #include<stdio.h> #include<queue> #include<stack> #include<map> #include<vector> #include<deque> #include<algorithm> using namespace std; #define INF 100861111 #define ll long long #define eps 1e-7 #define maxn 20 int main() { long long x1,y1,x2,y2,x3,y3,k1,k2,d1,d2; scanf("%lld%lld%lld%lld%lld%lld",&x1,&y1,&x2,&y2,&x3,&y3); d1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); d2=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3); if(d1!=d2) { printf("No\n"); return 0; } if((x2-x3)*(y1-y2)==(x1-x2)*(y2-y3)) { printf("No\n"); } else printf("Yes\n"); return 0; }
相关文章推荐
- Codeforces 851B && Round #432 Div. 2 B. Arpa and an exam about geometry
- Codeforces Round #432 Div2 B. Arpa and an exam about geometry
- Codeforces Round #432 (Div. 2) - B - Arpa and an exam about geometry
- 【推导】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) 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
- 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
- B - Arpa and an exam about geometry
- Codeforces Round#432 B. Arpa and an exam about geometry
- B. Arpa and an exam about geometry
- codeforce 851 B Arpa and an exam about geometry(思路)
- codeforces Div#432 B Arpa and an exam about geometry(技巧)
- Codeforces Round #383 (Div. 2) A. Arpa’s hard exam and Mehrdad’s naive cheat(水题)
- Codeforces Round #383 (Div. 2) A. Arpa’s hard exam and Mehrdad’s naive cheat(快速幂水题)
- Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum 数学公式结论找规律水题
- Codeforces #260 (Div. 2) B. Fedya and Maths(数学:水题)
- Codeforces Round #383 (Div. 2) B. Arpa’s obvious problem and Mehrdad’s terrible solution 数学
- ICM Technex 2018 and Codeforces Round #463 (Div. 1 + Div. 2, combined) Codeforces932 A. Palindromic Supersequence(水题) B.Recursive Queries(前缀和) C.Permutation Cycle(数学)