博客
关于我
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/

    你可能感兴趣的文章
    Objective-C实现FTP上传文件(附完整源码)
    查看>>
    Objective-C实现FTP文件上传(附完整源码)
    查看>>
    Objective-C实现FTP文件下载(附完整源码)
    查看>>
    Objective-C实现fuzzy operations模糊运算算法(附完整源码)
    查看>>
    Objective-C实现Gale-Shapley盖尔-沙普利算法(附完整源码)
    查看>>
    Objective-C实现gamma recursive伽玛递归算法(附完整源码)
    查看>>
    Objective-C实现gamma 伽玛功能算法(附完整源码)
    查看>>
    Objective-C实现gauss easte高斯复活节日期算法(附完整源码)
    查看>>
    Objective-C实现gaussian filter高斯滤波器算法(附完整源码)
    查看>>
    Objective-C实现gaussian naive bayes高斯贝叶斯算法(附完整源码)
    查看>>
    Objective-C实现gaussian高斯算法(附完整源码)
    查看>>
    Objective-C实现geometric series几何系列算法(附完整源码)
    查看>>
    Objective-C实现getline函数功能(附完整源码)
    查看>>
    Objective-C实现gnome sortt侏儒排序算法(附完整源码)
    查看>>
    Objective-C实现graph list图列算法(附完整源码)
    查看>>
    Objective-C实现GraphEdge图边算法(附完整源码)
    查看>>
    Objective-C实现GraphVertex图顶点算法(附完整源码)
    查看>>
    Objective-C实现greatest common divisor最大公约数算法(附完整源码)
    查看>>