Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B
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.
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.
Print "Yes" if the problem has a solution, "No" otherwise.
You can print each letter in any case (upper or lower).
0 1 1 1 1 0
Yes
1 1 0 0 1000 1000
No
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这个位置
解法:
1 AB BC距离相等
2 大概想到是一个.....扇子..不能符合条件的只有三点共线的情况
1 #include<bits/stdc++.h> 2 using namespace std; 3 struct Node{ 4 long long x,y; 5 }node[12]; 6 long long dis(Node a,Node b){ 7 return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); 8 } 9 int main(){ 10 for(int i=1;i<=3;i++){ 11 cin>>node[i].x>>node[i].y; 12 } 13 14 long long a=(node[2].x-node[1].x)*(node[3].y-node[1].y); 15 long long b=(node[2].y-node[1].y)*(node[3].x-node[1].x); 16 if(a!=b&&(dis(node[1],node[2])==dis(node[2],node[3]))){ 17 cout<<"Yes"<<endl; 18 }else{ 19 cout<<"No"<<endl; 20 } 21 return 0; 22 }