﻿

# Untitled

Dec 12th, 2019
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <bits/stdc++.h>
2. using namespace std;
3.
4. int tab[7][7] = {{0, 0, 0, 1, 0, 0, 0},
5. {0, 0, 1, 1, 1, 0, 0},
6. {0, 1, 0, 1, 1, 1, 0},
7. {1, 1, 1, 1, 1, 0, 1},
8. {0, 1, 1, 0, 1, 1, 0},
9. {0, 0, 1, 1, 1, 0, 0},
10. {0, 0, 0, 1, 0, 0, 0}};
11.
12. const int MAX = 45;
13. int res[8][8][MAX];
14.
15.
16. vector <vector <pair <int, int> > > ruchy = {{{1, 1}, {1, -1}, {-1, 1}, {-1, -1}},
17. {{1, 2}, {1, -2}, {2, 1}, {2, -1}, {-1, 2}, {-1, -2}, {-2, 1}, {-2, -1}}};
18.
19. int main()
20. {
21. int x,y;
22. cin >> x >> y;
23. int n; cin >> n;
24. res[y][x][0] = 1;
25.
26. for(int i = 1; i <= n; ++i)
27. {
28. for(auto &p : ruchy[i%2])
29. {
30. for(int y = 0; y < 7; ++y)
31. {
32. for(int x = 0; x < 7; ++x)
33. {
34. int nx = x + p.first;
35. int ny = y + p.second;
36. if(ny >= 0 and nx >= 0 and nx < 7 and ny < 7 and tab[ny][nx] == 1 and tab[y][x] == 1)
37. {
38. res[ny][nx][i] += res[y][x][i - 1];
39. }
40. }
41. }
42. }
43. }
44.
45. int suma = 0;
46. for(int y = 0; y < 7; ++y)
47. {
48. for(int x = 0; x < 7; ++x)
49. {
50. suma += res[y][x][n];
51. }
52. }
53. cout << suma << "\n";
54. }
RAW Paste Data