Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int i[55], j[55], k, l[55];
  8.  
  9. int sign(int x)
  10. {
  11. return x < 0 ? -1 : ((x==0) ? 0 : 1);
  12. }
  13.  
  14. int main()
  15. {
  16. i[0] = 13; j[0] = 19; l[0] = 14;
  17. for (k = 1; k <= 50; k++)
  18. {
  19. i[k] = sign (i[k - 1] + 1) * (abs(abs(k - 1 - j[k - 1]) - abs(i[k - 1] - l[k - 1])));
  20. j[k] = j[k - 1] % 20 + max (i[k - 1] % 20, min (j[k - 1] - k + 1, l[k - 1] - k + 1)) - 10;
  21. l[k] = (k - 1) * (i[k - 1] + 1) * (j[k - 1] + 2) * (l[k - 1] + 3) % 20;
  22. if (i[k] + j[k] + 10 == 0 || i[k] + j[k] + 20 == 0)
  23. {
  24. cout << "Yes\n";
  25. cout << i[k] << " " << j[k] << " " << l[k] << " " << k;
  26. return 0;
  27. }
  28. }
  29. cout << "No\n";
  30. cout << i[50] << " " << j[50] << " " << l[50];
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement