hdu 2151
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2151
題意:中文……
mark:遞推。dp[i][j]代表第i時(shí)刻在第k棵樹的方法數(shù)。dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1]。
代碼:
#include <stdio.h> #include <string.h>int dp[110][110];int main() {int n,p,m,t;int i,j;while(~scanf("%d%d%d%d", &n, &p, &m, &t)){memset(dp, 0, sizeof(dp));dp[0][p] = 1;for(i = 1; i <= m; i++)for(j = 1; j <= n; j++)dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];printf("%d\n", dp[m][t]);}return 0; }轉(zhuǎn)載于:https://www.cnblogs.com/andre0506/archive/2012/07/08/2582009.html
總結(jié)
- 上一篇: poj 3275 Ranking the
- 下一篇: 手机应用在线打包url