Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int n, x, y, v;
- cin >> n >> x >> y >> v;
- int prv_tip[n][n];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- if(i % 2 == 0) {
- if(j % 2 == 0) {
- prv_tip[i][j] = 0;
- }
- else {
- prv_tip[i][j] = 1;
- }
- }
- else {
- if(j % 2 == 0) {
- prv_tip[i][j] = 1;
- }
- else {
- prv_tip[i][j] = 0;
- }
- }
- }
- }
- int vtor_tip[n][n];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- if(j < n - i) {
- vtor_tip[i][j] = 1;
- }
- else {
- vtor_tip[i][j] = 0;
- }
- }
- }
- if(v == prv_tip[y][x] and v == vtor_tip[y][x]) {
- cout << 3 << endl;
- }
- else if(v == prv_tip[y][x]) {
- cout << 1 << endl;
- }
- else if(v == vtor_tip[y][x]) {
- cout << 2 << endl;
- }
- else {
- cout << 4 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement