#include<stdio.h>
int main()
{
int x,y,n,count=0;
scanf("%d",&n);
for(x=1;x<100;x++){
for(y=1;y<100;y++){
if(x*x+y*y==n&&x<=y){
if(count>0){
printf("\n");
}//除了第一行解,其他每行解都先换行
count++;
printf("%d %d",x,y);
}
}
}
if(count==0){
printf("No Solution");
}
return 0;
}
7-21 求特殊方程的正整数解 (15分)
最新推荐文章于 2022-03-04 15:55:38 发布