Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cstdlib>
- #include<utility>
- #include<set>
- #include<map>
- #include<iostream>
- #include<vector>
- #include<cmath>
- #include<algorithm>
- #include<iomanip>
- #include<stack>
- using namespace std;
- int main() {
- long long n;
- cin >> n;
- for (long long a = 0; a * a <= n; a++) {
- for (long long b = 0; b * b <= n; b++) {
- for (long long c = 0; c * c <= n; c++) {
- for (long long d = 0; d * d <= n; d++) {
- long long temp = a * a + b * b + c * c + d * d;
- if (temp == n) {
- if (a != 0) {
- cout << a << " ";
- }
- if (b != 0) {
- cout << b << " ";
- }
- if (c != 0) {
- cout << c << " ";
- }
- if (d != 0) {
- cout << d << " ";
- }
- //system("pause");
- return 0;
- }
- }
- }
- }
- }
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement