JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

3.9勾股数

发布时间 2023-05-24 21:47:20作者: 啵菠菜

1.问题

所谓勾股数,就是能够构成直角三角形的三个正整数。

2.代码

#include<cstdio>
using namespace std;
int a,b;
int main()
{
scanf("%d%d",&a,&b);
for(int i=a;i<=b;i++)
{
for(int j=i;j<=b;j++)
{
for(int n=j;n<=b;n++)
{
if(i*i+j*j==n*n)
printf("%d %d %d\n",i,j,n);
}
}
}
return 0;
}

    本栏目推荐文章
  • 3.9 指令传送和预测的先进技术
  • macos pip3 安装 mycli/scrapy 路径报错 WARNING: The script tabulate is installed in '/Users/modys/Library/Python/3.9/bin' which is not on PATH.
  • 3.9 Java位运算符:Java移位运算符、复合位赋值运算符及位逻辑运算符
  • Python3.6升级到3.9
  • 已解决 DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop workingfrom collections import Iterable
  • 如何快速生成勾股数
  • 3.9勾股数
  • 30.勾股数
  • ModuleNotFoundError: No module named 'Crypto', Python 3.9, PyCharm
  • 打卡 c语言趣味编程 求勾股数
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们