Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void patrate(int n, int &x, int &y) {
- bool ok = false;
- for (x = 2; x < n; x++) {
- for (y = x + 1; y <= n; y++) {
- if (x * x * y * y == n) {
- ok = true;
- break;
- }
- }
- if (ok) {
- break;
- }
- }
- if (!ok)
- x = y = 0;
- }
- int main() {
- int x = 1, y = 1;
- patrate(400, x, y);
- cout << x << ' ' << y << endl;//2 10
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement