Stupid Tower Defense
The map is a line, which has n unit length. We can build only one
tower on each unit length. The enemy takes t seconds on each unit length. And
there are 3 kinds of tower in this game: The red tower, the green tower and the
blue tower.
The red tower damage on the enemy x points per second when
he passes through the tower.
The green tower damage on the enemy y points
per second after he passes through the tower.
The blue tower let the
enemy go slower than before (that is, the enemy takes more z second to pass an
unit length, also, after he passes through the tower.)
Of course, if you
are already pass through m green towers, you should have got m*y damage per
second. The same, if you are already pass through k blue towers, the enemy
should have took t + k*z seconds every unit length.
FSF now wants to know
the maximum damage the enemy can get.
The first line
contains an integer T (T<=100), indicates the number of cases.
Each
test only contain 5 integers n, x, y, z, t (2<=n<=1500,0<=x, y,
z<=60000,1<=t<=3)
where C indicates the case number and counts from 1. Then output the answer. For
each test only one line which have one integer, the answer to this
question.
#include"iostream"
#include"cstdio"
#include"cstring"
using namespace std;
typedef __int64 LL;
const int ms=;
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=;
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,,sizeof(dp));
ans=x*n*t;
for(b=;b<=n;b++)
for(c=;c+b<=n;c++)
{
dp[b+][c]=max(dp[b+][c],dp[b][c]+c*y*(t+b*z));
dp[b][c+]=max(dp[b][c+],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 ;
}
Stupid Tower Defense的更多相关文章
- dp --- hdu 4939 : Stupid Tower Defense
Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/ ...
- hdu4939 Stupid Tower Defense (DP)
2014多校7 第二水的题 4939 Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 131 ...
- 初识Tower Defense Toolkit
Tower Defense Toolkit 做塔防游戏的插件 主要层次如下图: 1GameControl _ _Game Control(Script) _ _ _Spawn Manager _ _ ...
- HDU4939Stupid Tower Defense (有思想的dp)
Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Oth ...
- Tower Defense Game
Tower Defense Game 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 There is a tower defense game with n level ...
- hdu 4779 Tower Defense (思维+组合数学)
Tower Defense Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) ...
- HDU 4779:Tower Defense
Tower Defense Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)T ...
- hihoCoder #1199 : Tower Defense Game ——(树型dp)
题目链接:https://hihocoder.com/problemset/problem/1199. 题意:一棵以1为根的树,每个点有一个p值和q值,到这个点需要当前分数大于等于p,然后消耗掉(p- ...
- HDU 4939 Stupid Tower Defense(dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4939 解题报告:一条长度为n的线路,路上的每个单元格可以部署三种塔来给走在这条路上的敌人造成伤害,第一 ...
随机推荐
- BootStrap入门教程 (四) :JQuery类库插件(模态窗口,滚动监控,标签效果,提示效果,“泡芙”效果,警告区域,折叠效果,旋转木马,输入提示)
上讲回顾:Bootstrap组件丰富同时具有良好可扩展性,能够很好地应用在生产环境.这些组件包括按钮(Button),导航(Navigation),缩略图( thumbnails),提醒(Alert) ...
- 批量ping主机脚本
#! /bin/bash for i in `cat test.list`do host=`echo $i|awk -F"," '{print $1}'` app_IP=` ...
- HDU 4882 ZCC Loves Codefires (贪心)
ZCC Loves Codefires 题目链接: http://acm.hust.edu.cn/vjudge/contest/121349#problem/B Description Though ...
- HDU/杭电2013多校第三场解题报告
今天悲剧了,各种被虐啊,还是太年轻了 Crime 这道题目给的时间好长,第一次就想到了暴力,结果华丽丽的TLE了. 后来找了一下,发现前24个是1, 2, 6, 12, 72, 72, 864, 17 ...
- SQLite内存数据库
[转]SQLite内存数据库 http://www.cnblogs.com/liuyong/archive/2010/09/14/1826152.html SQLite 介绍 一. SQLite 是实 ...
- 项目经验之:再来一章:excel导入数据 封装成最棒的不容易!!!
我见过很的系统,包括OA,ERP,CRM等,在常用的功能当中,从外部导入数据是最常用到的.因为很多客户需要以excel的形式提供数据,,这样的方式我们又如何做呢, 大家最常见的做法可能是这样的,在需要 ...
- [cocos2d-x3.0]Xcode 升级到5.1后,cocos2d-x3.0 编译64bit出错解决方案
转自:http://blog.csdn.net/blucenong/article/details/21198089 把Architectures --->Other 改成 $(ARCHS_ST ...
- #定位系统性能瓶颈# strace & ltrace
strace和ltrace分别相应的是系统调用和库函数调用, 系统调用实际上就是指最底层的一个调用,在linux程序设计里面就是底层调用的意思,面向的是硬件. 而库函数调用则面向的是应用开发的.相当于 ...
- 破解中国电信华为无线猫路由(HG522-C)自己主动拨号+不限电脑数+iTV
中国电信总是把好好的一个路由猫阉割过后放在我的E家套餐里到处兜售(垄断市场也就罢了,还有非常多霸王条款,比方必须使用它们的手机,同一时候最多多少台电脑上网等等),曾经破解过另外一个中国电信的路由猫,非 ...
- TChromeTabs 优化改进
已知未解决问题 全屏时当窗体失去焦点,则会显示出未绘制完成的原标题栏(Fixed): 处于非 Areo 效果下时,窗体标题栏需要定制. 新增按钮上的 Hint 提示后再移至其它标签,将无法重新提示. ...