Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- #include <cmath>
- #include <sstream>
- using namespace std;
- int main()
- {
- long long n, x, y, sc = 0, promx, promy;
- cin >> n >> x >> y;
- sc = 0;
- {
- if (x != n&&x != 1)
- if (y != n&&y != 1)
- sc += 8;
- else
- if (y != n || y != 1)
- sc += 5;
- else
- sc += 2;
- else
- if (x != n || x != 1)
- {
- if (y != n&&y != 1)
- sc += 5;
- else
- if (y != n || y != 1)
- sc += 3;
- else
- sc += 1;
- }
- else
- {
- if (y != n&&y != 1)
- sc += 2;
- else
- if (y != n || y != 1)
- sc += 1;
- }
- }
- cout << "King: " << sc << endl;
- sc = 0;
- {
- if (x + 2 <= n)
- if (y + 1 <= n && y - 1 >= 1)
- sc = sc + 2;
- else
- sc = sc + 1;
- if (x - 2 >= 1)
- if (y + 1 <= n && y - 1 >= 1)
- sc = sc + 2;
- else
- sc = sc + 1;
- if (y - 2 >= 1)
- if (x + 1 <= n && x - 1 >= 1)
- sc = sc + 2;
- else
- sc = sc + 1;
- if (y + 2 <= n)
- if (x + 1 <= n && x - 1 >= 1)
- sc = sc + 2;
- else
- sc = sc + 1;
- }
- cout << "Knight: " << sc << endl;
- sc = 0;
- if (x - 1 < y - 1)
- sc += x - 1;
- else
- sc += y - 1;
- if (x - 1 < n-y)
- sc += x - 1;
- else
- sc += n - y;
- if (n-x < y - 1)
- sc += n-x;
- else
- sc += y - 1;
- if (n - x < n - y)
- sc += n - x;
- else
- sc += n - y;
- cout << "Bishop: " << sc << endl;
- cout << "Rook: " << n * 2 - 2 << endl;
- cout << "Queen: " << (n * 2 - 2) + sc << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment