博客
关于我
1079 三角形
阅读量:626 次
发布时间:2019-03-13

本文共 1456 字,大约阅读时间需要 4 分钟。

???????????????????ai???????????????????????????????????ai?????????????????????????????ai??????????????????????????????????

????

  • ?????

    • ????????????(a^2 + b^2 = c^2)???c????
    • ??????ai????????????
  • ?????

    • ?ai?????????c????ai????(c^2 = ai^2 + b^2)?
    • ?ai?????????a????ai????(a^2 + b^2 = ai^2)?
  • ?????

    • ???????c?????????b??????
    • ????????a?????????b??????
  • ?????

    • ???????????????????????
    • ???????????
  • ????

    #include 
    #include
    #include
    #include
    #include
    using namespace std;void work(int d) { // ?d??????????c for (int c = d + 1; c <= 2 * d * d; ++c) { int b_sq = c * c - d * d; if (b_sq <= 0) continue; int b = sqrt(b_sq); if (b * b == b_sq && b < c) { cout << c << "," << b << endl; } } // ?d??????????a for (int a = 1; a < d; ++a) { int b_sq = d * d - a * a; if (b_sq <= 0) continue; int b = sqrt(b_sq); if (b * b == b_sq && a > b) { cout << a << "," << b << endl; } } cout << endl;}int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) { int d; cin >> d; work(d); } return 0;}

    ????

  • ?????

    • ??n??????
    • ?????????????d?
  • ????work(d)?

    • ?d?????????????c???b?????????
    • ?d?????????????a???b?????????
  • ?????

    • ???????????????????????
    • ??????????????????
  • ?????

    • ?????????????????
  • ???????????????????????????????????

    转载地址:http://elraz.baihongyu.com/

    你可能感兴趣的文章
    Node.js高级编程:用Javascript构建可伸缩应用(1)1.1 介绍和安装-安装Node
    查看>>
    nodejs + socket.io 同时使用http 和 https
    查看>>
    NodeJS @kubernetes/client-node连接到kubernetes集群的方法
    查看>>
    NodeJS API简介
    查看>>
    Nodejs express 获取url参数,post参数的三种方式
    查看>>
    nodejs http小爬虫
    查看>>
    nodejs libararies
    查看>>
    nodejs npm常用命令
    查看>>
    nodejs npm常用命令
    查看>>
    Nodejs process.nextTick() 使用详解
    查看>>
    NodeJS yarn 或 npm如何切换淘宝或国外镜像源
    查看>>
    nodejs 中间件理解
    查看>>
    nodejs 创建HTTP服务器详解
    查看>>
    nodejs 发起 GET 请求示例和 POST 请求示例
    查看>>
    NodeJS 导入导出模块的方法( 代码演示 )
    查看>>
    nodejs 开发websocket 笔记
    查看>>
    nodejs 的 Buffer 详解
    查看>>
    NodeJS 的环境变量: 开发环境vs生产环境
    查看>>
    nodejs 读取xlsx文件内容
    查看>>
    nodejs 运行CMD命令
    查看>>