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

    你可能感兴趣的文章
    NSGA-Ⅲ源代码
    查看>>
    nsis 安装脚本示例(转)
    查看>>
    NSJSON的用法(oc系统自带的解析方法)
    查看>>
    nslookup 的基本知识与命令详解
    查看>>
    NSNumber与NSInteger的区别 -bei
    查看>>
    NSOperation基本操作
    查看>>
    NSRange 范围
    查看>>
    NSSet集合 无序的 不能重复的
    查看>>
    NSURLSession下载和断点续传
    查看>>
    NSUserdefault读书笔记
    查看>>
    NS图绘制工具推荐
    查看>>
    NT AUTHORITY\NETWORK SERVICE 权限问题
    查看>>
    NT symbols are incorrect, please fix symbols
    查看>>
    ntelliJ IDEA 报错:找不到包或者找不到符号
    查看>>
    NTFS文件权限管理实战
    查看>>
    ntko web firefox跨浏览器插件_深度比较:2019年6个最好的跨浏览器测试工具
    查看>>
    ntko文件存取错误_苹果推送 macOS 10.15.4:iCloud 云盘文件夹共享终于来了
    查看>>
    ntp server 用法小结
    查看>>
    ntpdate 通过外网同步时间
    查看>>
    ntpdate同步配置文件调整详解
    查看>>