标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3407 Accepted Submission(s): 2194
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 #include<algorithm> 6 using namespace std; 7 const int INF=0x3f3f3f3f; 8 const double PI=acos(-1); 9 #define mem(x,y) memset(x,y,sizeof(x)) 10 int dp[110][110]; 11 int main(){ 12 int N,P,M,T; 13 while(~scanf("%d%d%d%d",&N,&P,&M,&T)){ 14 mem(dp,0); 15 dp[0][P]=1; 16 for(int i=1;i<=M;i++){ 17 for(int j=1;j<=N;j++){ 18 for(int k=1;k<=N;k++){ 19 if(abs(j-k)==1)dp[i][k]=max(dp[i][k],dp[i-1][j]+dp[i][k]); 20 } 21 } 22 } 23 printf("%d\n",dp[M][T]); 24 } 25 return 0; 26 }
标签:
原文地址:http://www.cnblogs.com/handsomecui/p/4965111.html