标签:div for 二次 16px family class can ble pre
Input:输入两个正整数a,b (a<b).
Output:输出[a,b]区间内的所有勾股数组。
Sample Input:30,90
30^2+40^2=50^2
30^2+72^2=78^2
32^2+60^2=68^2
33^2+44^2=55^2
33^2+56^2=65^2
36^2+48^2=60^2
36^2+77^2=85^2
39^2+52^2=65^2
39^2+80^2=89^2
40^2+42^2=58^2
40^2+75^2=85^2
42^2+56^2=70^2
45^2+60^2=75^2
48^2+55^2=73^2
48^2+64^2=80^2
51^2+68^2=85^2
54^2+72^2=90^2
60^2+63^2=87^2
代码:
#include <stdio.h> void main() { int a,b,i,j,k; scanf("%d,%d",&a,&b); for(i=a;i<=b;i++) { for(j=i+1;j<=b;j++) { for(k=j+1;k<=b;k++) { if(i*i + j*j = k*k) printf("%d^2+%d^2=%d^2\n",i,j,k); } } } }
标签:div for 二次 16px family class can ble pre
原文地址:https://www.cnblogs.com/Zhuohome/p/12839950.html