Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- double SQRT=sqrt(n);
- for (int i=0;i<=SQRT;i++)
- {
- for (int j=0;j<=SQRT;j++)
- {
- for (int k=0;k<=SQRT;k++)
- {
- for (int m=0;m<=SQRT;m++)
- {
- if (m*m+k*k+j*j+i*i==n)
- {
- cout<<i<<" "<<j<<" "<<k<<" "<<m;
- return 0;
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement