zoukankan      html  css  js  c++  java
  • 【推导】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B. Arpa and an exam about geometry

    题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置。

    只要A,B,C构成等腰三角形,且B为上顶点。那么其外接圆圆心即是一个合法的旋转中心。画个图很显然。

    注意A,B,C三点共线时不可。

    #include<cstdio>
    using namespace std;
    typedef long long ll;
    struct Point{
    	ll x,y;
    	Point(const ll &x,const ll &y){
    		this->x=x;
    		this->y=y;
    	}
    	Point(){}
    	ll len2(){
    		return x*x+y*y;
    	}
    	void read(){
    		scanf("%I64d%I64d",&x,&y);
    	}
    }a,b,c;
    typedef Point Vector;
    Vector operator - (const Point &a,const Point &b){
    	return Vector(a.x-b.x,a.y-b.y);
    }
    ll Cross(const Vector &a,const Vector &b){
    	return a.x*b.y-a.y*b.x;
    }
    int main(){
    	a.read();
    	b.read();
    	c.read();
    	if((a-b).len2()==(c-b).len2() && Cross(a-b,b-c)!=0){
    		puts("Yes");
    	}
    	else{
    		puts("No");
    	}
    	return 0;
    }
  • 相关阅读:
    https://leetcode-cn.com/problems/binary-search/solution/er-fen-cha-zhao-by-leetcode/
    Question_add-two-numbers
    leetcode merge-two-sorted-lists
    leetcode 1108
    leetcode 1107
    git
    sql 语句
    cas
    OMP 算法
    OC----预处理器
  • 原文地址:https://www.cnblogs.com/autsky-jadek/p/7478158.html
Copyright © 2011-2022 走看看