• 【Codeforces Round #432 (Div. 2) B】Arpa and an exam about geometry


    【链接】h在这里写链接


    【题意】


    给你3个点A,B,C
    问你能不能将纸绕着坐标轴上的一点旋转。使得A与B重合,B与C重合

    【题解】


    这3个点必须共圆。
    则A,B,C不能为一条直线。否则无解。
    共圆之后.角AOB必须等于角BOC.也即等价于|AB|=|AC|
    (圆周角定理)
    判断|AB|==|AC|之后,判断一下B是不是A和C的中点,就能排除在一条线上的情况。
    (中点只会涉及到整数。可以避免double的误差)

    【错的次数】


    3

    【反思】


    能用整数判断,都尽量用整数判断。
    整数不会有误差!

    【代码】

    /*
    
    */
    #include <cstdio>
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <vector>
    #include <map>
    #include <queue>
    #include <iomanip>
    #include <set>
    #include <cstdlib>
    #include <cmath>
    #include <bitset>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb emplace_back
    #define fi first
    #define se second
    #define ld long double
    #define ms(x,y) memset(x,y,sizeof x)
    #define ri(x) scanf("%d",&x)
    #define rl(x) scanf("%lld",&x)
    #define rs(x) scanf("%s",x)
    #define rf(x) scnaf("%lf",&x)
    #define oi(x) printf("%d",x)
    #define ol(x) printf("%lld",x)
    #define oc putchar(' ')
    #define os(x) printf(x)
    #define all(x) x.begin(),x.end()
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0)
    #define sz(x) ((int) x.size())
    #define ld long double
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    //mt19937 myrand(time(0));
    //int get_rand(int n){return myrand()%n + 1;}
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 110;
    
    LL ax,ay,bx,by,cx,cy;
    
    LL sqr(LL x){
        return x*x;
    }
    
    LL dis(LL x1,LL y1,LL x2,LL y2){
        return sqr(x2-x1)+sqr(y2-y1);
    }
    
    int main(){
        //Open();
        //Close();
        cin >> ax >> ay >> bx >> by >> cx >> cy;
        LL C = dis(ax,ay,bx,by);
        LL A = dis(bx,by,cx,cy);
        LL B = dis(ax,ay,cx,cy);
        if (C==A){
            if ( (ax+cx)==2*bx && (ay+cy)==2*by)
                puts("No");
            else
                puts("Yes");
        }else
            puts("No");
        return 0;
    }
    
    


  • 相关阅读:
    JavaScript 循环语句
    python 学习(day1)
    spring定时任务(@Scheduled注解)cron表达式详解
    IDEA 实用插件
    mysql版本和mysql-connector-java的对应关系记录
    CAS单点登录(理论部分)
    AOP
    获取post请求数据工具类
    nodeJs 安装
    docker 安装Nginx
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626047.html
Copyright © 2020-2023  润新知