zoukankan      html  css  js  c++  java
  • 【Codeforces Round #239 (Div. 1) A】Triangle

    【链接】 我是链接,点我呀:)
    【题意】

    在这里输入题意

    【题解】

    最后的直角三角形可以通过平移,将直角顶点移动到坐标原点。 然后我们只要枚举另外两个点其中一个点的坐标就好了。 x坐标的范围是[1..a) 因为再长的话,这条边肯定就超过边长a了。 然后用一些相似三角形的规律就能知道另外一个点的坐标了。 看看这两个点的y坐标是不是一样就好。

    【代码】

    #include <bits/stdc++.h>
    using namespace std;
    
    int a,b;
    
    int main(){
    	#ifdef LOCAL_DEFINE
    	    freopen("rush_in.txt", "r", stdin);
    	#endif
    	ios::sync_with_stdio(0),cin.tie(0);
        cin >> a >> b;
        for (int i = 1;i  < a;i++){
            int x = i;
            int y = sqrt(a*a-x*x);
            if (y*y+x*x==a*a && b*y%a==0 && b*x%a==0 && b*x/a!=y){
                cout<<"YES"<<endl;
                cout<<"0 0"<<endl;
                cout<<x<<' '<<y<<endl;
                cout<<-b*y/a<<' '<<b*x/a<<endl;
                return 0;
            }
        }
        cout<<"NO"<<endl;
    	return 0;
    }
    
  • 相关阅读:
    预编译命令 #if DEBUG
    conda常用命令
    tensorflow 安装指南
    LocNET和池化理解
    同时安装cuda8和cuda9
    np.transpose
    python中List的slice用法
    书单
    训练工程
    linux 查看进程
  • 原文地址:https://www.cnblogs.com/AWCXV/p/8448065.html
Copyright © 2011-2022 走看看