Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <math.h>
- using namespace std;
- struct point
- {
- int x, y;
- };
- int main()
- {
- point Lev, Gien;
- int k;
- Lev.y = 1;
- cin >> k >> Lev.x >> Gien.x >> Gien.y;
- while (Lev.y != k)
- {
- if (((Gien.x != Lev.x)||(Gien.y != Lev.y + 1))&&(abs(Lev.x - Lev.y - 1) != abs(Gien.x - Gien.y))&&(Lev.x + Lev.y + 1 != Gien.x + Gien.y))
- {
- ++Lev.y;
- cout << Lev.y << " " << Lev.x << endl;
- cout.flush();
- }
- else if (Lev.x != 1)
- {
- --Lev.x;
- ++Lev.y;
- cout << Lev.y << " " << Lev.x << endl;
- cout.flush();
- }
- else
- {
- ++Lev.x;
- ++Lev.y;
- cout << Lev.y << " " << Lev.x << endl;
- cout.flush();
- }
- if (Lev.y != k)
- {
- cin >> Gien.x >> Gien.y;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement