Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdio>
- using namespace std;
- int i[55], j[55], k, l[55];
- int sign(int x)
- {
- return x < 0 ? -1 : ((x==0) ? 0 : 1);
- }
- int main()
- {
- i[0] = 13; j[0] = 19; l[0] = 14;
- for (k = 1; k <= 50; k++)
- {
- i[k] = sign (i[k - 1] + 1) * (abs(abs(k - 1 - j[k - 1]) - abs(i[k - 1] - l[k - 1])));
- j[k] = j[k - 1] % 20 + max (i[k - 1] % 20, min (j[k - 1] - k + 1, l[k - 1] - k + 1)) - 10;
- l[k] = (k - 1) * (i[k - 1] + 1) * (j[k - 1] + 2) * (l[k - 1] + 3) % 20;
- if (i[k] + j[k] + 10 == 0 || i[k] + j[k] + 20 == 0)
- {
- cout << "Yes\n";
- cout << i[k] << " " << j[k] << " " << l[k] << " " << k;
- return 0;
- }
- }
- cout << "No\n";
- cout << i[50] << " " << j[50] << " " << l[50];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement