Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n,m;
- cin >> n >> m;
- int board[n][m];
- for(int i=0; i < n; i++){
- for(int j=0; j<m; j++){
- board[i][j] = 0;
- }
- }
- board[0][0] = 1;
- for(int i = 0; i < n; i++){
- for(int j = 0; j < m; j++){
- int temp = 0;
- if(i >= 1 && j >= 2){
- temp += board[i-1][j-2];
- }
- if(i >= 2 && j >= 1){
- temp += board[i-2][j-1];
- }
- board[i][j] += temp;
- }
- }
- cout << board[n-1][m-1] << endl;
- }
Add Comment
Please, Sign In to add comment