1 #include<iostream> 2 #include<iomanip> 3 #include<cmath> 4 using namespace std; 5 int main(){ 6 int i,n,flag=1; 7 cin>>n; 8 for(i=1;i<=sqrt(n/2);++i) 9 if(sqrt(n-pow(i,2))==int(sqrt(n-pow(i,2)))){ 10 cout<<i<<" "<<sqrt(n-pow(i,2))<<endl; 11 flag=0; 12 } 13 if(flag) 14 cout<<"No Solution"<<endl; 15 return 0; 16 }
循环-13. 求特殊方程的正整数解(15)
时间: 2024-10-10 20:53:20