标签:des style blog color os io for ar
#include"iostream" #include"cstdio" #include"cstring" using namespace std; typedef __int64 LL; const int ms=1600; LL dp[ms][ms]; LL max(LL a,LL b) { return a>b?a:b; } int main() { LL ans,b,c;//注意 b和c 要定义为LL,因为后面的计算中含有LL形的数。 int T,p=1; int n,x,y,z,t; scanf("%d",&T); //cin>>T; while(T--) { printf("Case #%d: ",p++); //cout<<"Case #"<<p++<<": "; scanf("%d%d%d%d%d",&n,&x,&y,&z,&t); //cin>>n>>x>>y>>z>>t; memset(dp,0,sizeof(dp)); ans=x*n*t; for(b=0;b<=n;b++) for(c=0;c+b<=n;c++) { dp[b+1][c]=max(dp[b+1][c],dp[b][c]+c*y*(t+b*z)); dp[b][c+1]=max(dp[b][c+1],dp[b][c]+c*y*(t+b*z)); ans=max(ans,dp[b][c]+(n-b-c)*x*(t+b*z)+(n-b-c)*y*c*(t+b*z)); } printf("%I64d\n",ans); //cout<<ans<<endl; } return 0; }
Stupid Tower Defense,布布扣,bubuko.com
标签:des style blog color os io for ar
原文地址:http://www.cnblogs.com/767355675hutaishi/p/3908333.html