http://acm.hdu.edu.cn/showproblem.php?pid=2151

View Code
#include <stdio.h>
#include <string.h>
int n,p,m,t ;
int dp[110][110] ;
int main()
{
    while(~scanf("%d%d%d%d",&n,&p,&m,&t))
    {
        memset(dp,0,sizeof(dp)) ;
        dp[0][p]=1 ;
        for(int i=0;i<=m;i++)
            for(int j=1;j<=n;j++)
            {
                if(j>=2)
                    dp[i+1][j-1]+=dp[i][j] ;
                if(j<n)
                    dp[i+1][j+1]+=dp[i][j] ;
            }
        printf("%d\n",dp[m][t]) ;
    }
    return 0 ;
} 

 

相关文章:

  • 2021-08-01
  • 2021-08-25
  • 2021-07-29
  • 2021-12-15
  • 2021-06-03
  • 2021-05-26
猜你喜欢
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-02-25
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案