Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int x[20];
  6. int y[20];
  7.  
  8. void init()
  9. {
  10. x[0] = 1;
  11. x[1] = 1;
  12. y[0] = 0;
  13. y[1] = -1;
  14. for (int i = 2; i < 20; ++i)
  15. {
  16. x[i] = x[i-1] + x[i-2];
  17. y[i] = y[i-1] + y[i-2];
  18. }
  19. }
  20.  
  21. int main()
  22. {
  23. int X, Y;
  24. cin >> X >> Y;
  25. int ans1, ans2;
  26. init();
  27.  
  28. for (int i = 0; i < Y; ++i)
  29. {
  30. for (int j = 0; j < Y; ++j)
  31. {
  32. if (x[X-1]*i + y[X-1]*j == Y)
  33. {
  34. ans1 = i;
  35. ans2 = ans1 - j;
  36. cout << ans1 << " " << ans2;
  37. return 0;
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement