Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B. Arpa and an exam about geometry
题意:给出三个点A,B,C,问是否存在一个点,使得 A转到 B,B转到C
思路:即AB==AC并且三点不共线
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 5 int main(){ 6 ll ax,ay; 7 ll bx,by; 8 ll cx,cy; 9 cin>>ax>>ay>>bx>>by>>cx>>cy; 10 ll s1=(ax-bx)*(ax-bx)+(ay-by)*(ay-by); 11 ll s2=(cx-bx)*(cx-bx)+(cy-by)*(cy-by); 12 if((ax-bx)*(cy-by)==(ay-by)*(cx-bx)){ 13 cout<<"No"<<endl;return 0; 14 } 15 if(s1==s2){ 16 cout<<"Yes"<<endl; 17 } 18 else cout<<"No"<<endl; 19 }