简单dp HDU 2151

来源:互联网 发布:淘宝小号出售平台2016 编辑:程序博客网 时间:2024/04/30 06:46
#include <bits/stdc++.h>using namespace std;const int MAX_V = 105;int dp[MAX_V][MAX_V];int N, M, P, T;void solve(int m, int t){dp[0][P] = 1;for (int i = 1; i <= M; i++)for (int j = 1; j <= N; j++)dp[i][j] = (j == 1 ? 0 : dp[i - 1][j - 1]) + (j == N ? 0 : dp[i - 1][j + 1]);cout << dp[M][T] << endl;}int main(int argc, char const *argv[]){while (cin >> N >> P >> M >> T){memset(dp, 0, sizeof(dp));solve(M, T);}return 0;}

0 0