标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3875 Accepted Submission(s): 2503
@NOIP传球游戏 ←那题还要处理环,这里连环都没有
动规,f[i][j]=f[i-1][j-1]+f[i-1][j+1]
1 /**/ 2 #include<iostream> 3 #include<cstdio> 4 #include<cmath> 5 #include<cstring> 6 #include<algorithm> 7 using namespace std; 8 const int mxn=200; 9 int n,p,m,t; 10 int f[mxn][mxn]; 11 int main(){ 12 int i,j; 13 while(scanf("%d%d%d%d",&n,&p,&m,&t)!=EOF){ 14 memset(f,0,sizeof f); 15 f[0][p]=1; 16 for(i=1;i<=m;i++) 17 for(j=1;j<=n;j++){ 18 f[i][j]+=f[i-1][j-1]+f[i-1][j+1]; 19 } 20 printf("%d\n",f[m][t]); 21 } 22 return 0; 23 }
标签:
原文地址:http://www.cnblogs.com/SilverNebula/p/5862457.html