Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <bits/stdc++.h>
- using namespace std;
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- long long n;
- cin >> n;
- bool found = false;
- for (long long a = 1; a * a <= n; ++a) {
- long long r = n - a * a;
- if (r <= 0) break;
- long long b = (long long)floor(sqrt(r));
- if (b > 0 && b * b == r) {
- cout << a << " " << b << "\n";
- found = true;
- break;
- }
- }
- if (!found) {
- cout << "NO" << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement