Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int x[20];
- int y[20];
- void init()
- {
- x[0] = 1;
- x[1] = 1;
- y[0] = 0;
- y[1] = -1;
- for (int i = 2; i < 20; ++i)
- {
- x[i] = x[i-1] + x[i-2];
- y[i] = y[i-1] + y[i-2];
- }
- }
- int main()
- {
- int X, Y;
- cin >> X >> Y;
- int ans1, ans2;
- init();
- for (int i = 0; i < Y; ++i)
- {
- for (int j = 0; j < Y; ++j)
- {
- if (x[X-1]*i + y[X-1]*j == Y)
- {
- ans1 = i;
- ans2 = ans1 - j;
- cout << ans1 << " " << ans2;
- return 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement