Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int x, y;
- cin >> x >> y;
- vector<vector<int>> dp(8, vector<int>(8));
- if (y == 8)
- {
- cout << '1';
- }
- else
- {
- for (int j = 0; j < 8; ++j)
- {
- if (j == x - 1)
- {
- dp[y - 1][x - 1] = 1;
- }
- else
- {
- dp[y - 1][j] = 0;
- }
- }
- for (int i = y; i < 8; ++i)
- {
- for (int j = 0; j < 8; ++j)
- {
- if (j = 0)
- {
- dp[i][j] = dp[i - 1][j + 1];
- }
- else if (j = 7)
- {
- dp[i][j] = dp[i - 1][j - 1];
- }
- else
- {
- dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j + 1];
- }
- }
- }
- int sum = 0;
- for (int i = 0; i < 8; ++i)
- {
- sum += dp[7][i];
- }
- cout << sum;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement