Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int tab[7][7] = {{0, 0, 0, 1, 0, 0, 0},
- {0, 0, 1, 1, 1, 0, 0},
- {0, 1, 0, 1, 1, 1, 0},
- {1, 1, 1, 1, 1, 0, 1},
- {0, 1, 1, 0, 1, 1, 0},
- {0, 0, 1, 1, 1, 0, 0},
- {0, 0, 0, 1, 0, 0, 0}};
- const int MAX = 45;
- int res[8][8][MAX];
- vector <vector <pair <int, int> > > ruchy = {{{1, 1}, {1, -1}, {-1, 1}, {-1, -1}},
- {{1, 2}, {1, -2}, {2, 1}, {2, -1}, {-1, 2}, {-1, -2}, {-2, 1}, {-2, -1}}};
- int main()
- {
- int x,y;
- cin >> x >> y;
- int n; cin >> n;
- res[y][x][0] = 1;
- for(int i = 1; i <= n; ++i)
- {
- for(auto &p : ruchy[i%2])
- {
- for(int y = 0; y < 7; ++y)
- {
- for(int x = 0; x < 7; ++x)
- {
- int nx = x + p.first;
- int ny = y + p.second;
- if(ny >= 0 and nx >= 0 and nx < 7 and ny < 7 and tab[ny][nx] == 1 and tab[y][x] == 1)
- {
- res[ny][nx][i] += res[y][x][i - 1];
- }
- }
- }
- }
- }
- int suma = 0;
- for(int y = 0; y < 7; ++y)
- {
- for(int x = 0; x < 7; ++x)
- {
- suma += res[y][x][n];
- }
- }
- cout << suma << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement