标签:
Time Limit: 300/100 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 3940 Accepted Submission(s): 1028
#include <stdio.h> using namespace std; typedef long long LL; const int N = 25; int dp[N][3*N]; ///dp[i][j]代表进攻 i 次得到 j 分的方案数,最多也就 600/15/2次机会,分数最多为600/15/2*3分 int main(){ dp[0][0] = dp[1][1] = dp[1][2] = dp[1][3] =1; for(int i=2;i<N;i++){ for(int j=1;j<3*N;j++){ dp[i][j] += dp[i-1][j-1]; ///本次进攻得到1分 if(j>=2) dp[i][j]+=dp[i-1][j-2]; ///本次进攻得到2分 if(j>=3) dp[i][j]+=dp[i-1][j-3]; ///本次进攻得到3分 } } int n,m,t; while(scanf("%d%d%d",&n,&m,&t)!=EOF){ LL ans = 0; int t1,t2; t2 = t/30; t1 = t/15 - t2; m+=t2; ///对方的最终分数 int k = (m-n+1)>0?m-n+1:0; for(int i=k;i<=t1*3;i++){ ans+=dp[t1][i]; } printf("%lld\n",ans); } }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5597676.html