南邮 OJ 1443 Warcraft III
来源:互联网 发布:sql语句导入excel数据 编辑:程序博客网 时间:2024/05/21 17:50
Warcraft III
总提交 : 142 测试通过 : 49
比赛描述
John likes playing Warcraft III. Now, he is teaching his girlfriend to play it. In Warcraft III, there are many kinds of units. Every unit costs some gold and lumber. Different units have different attack value.
Now question comes. Given some amount of gold and a list of types of units, how to arrange your units to maximize the attack value of your units. Assume you have infinite lumbers.
输入
Line 1 contains an integer T: the number of test cases.
Next T blocks, each starts with two integers: G and U, represents the amount of gold and number of unit type. Next U lines, each contains two integers: attack value of a type of unit and the cost.
输出
For each test case, output the maximum total attack value in one line.
样例输入
2
100 1
20 10
300 4
100 60
250 120
120 100
35 20
样例输出
200
605
题目来源
NUPT ACM 2010 Personal Ranking Contest
#include<stdio.h>#define N 10000int unit[N];int cost[N];int maxAttack[N];int main(){int T,G,U,i,j;scanf("%d",&T);while(T--){scanf("%d%d",&G,&U);for(i=1; i<=G; i++){maxAttack[i] = 0;}while(U--){scanf("%d%d",&i,&j);maxAttack[j] = i;}for(i=1; i<=G; i++){for(j=1; j*2<=i; j++){if(maxAttack[i] < maxAttack[j]+maxAttack[i-j]){maxAttack[i] = maxAttack[j]+maxAttack[i-j];}}}printf("%d\n",maxAttack[G]);}}
- 南邮 OJ 1443 Warcraft III
- Hust oj 1053 Warcraft III(完全背包)
- HLG Warcraft III
- Warcraft III 分辨率设置
- 宽屏 WARCRAFT III 全屏的方法
- Warcraft III 守望者的烦恼
- Hrbust1053 Warcraft III (完全背包)
- HLG 1053 Warcraft III(背包DP)
- hrbust1053 Warcraft III (完全背包裸题)
- HLG 1053 Warcraft III 完全背包
- 南邮 OJ 2098 3_A+B(III)
- HLG 哈理工 1053 Warcraft III (完全背包)
- Warcraft III 守望者的烦恼 Vijos 矩阵快速幂
- vijos1067 Warcraft III 守望者的烦恼(矩阵倍增)
- light oj 1017 Brush (III)
- 矩阵十大经典题目之七- Warcraft--III--守望者的烦恼
- VOJ 1067 Warcraft III 守望者的烦恼 (矩阵快速幂+dp)
- 矩阵经典题目七:Warcraft III 守望者的烦恼(矩阵加速递推)
- 南邮 OJ 1442 temperature conversions
- windows系统 远程桌面限制单用户
- 九度oj 1162
- HDU1108 最小公倍数
- 图像处理文献资料
- 南邮 OJ 1443 Warcraft III
- 接收到推送消息时,提示声音
- 自己参考的常用命令
- 输出是m的倍数或n的倍数、但不是m和n的公倍数的数
- linux和STL 常用头文件及说明
- NSString 查找指定字符串出现的次数
- 浅析Java设计模式之装饰器模式
- 华为软件编程规范和范例 7 —— 代码编辑、编译、审查和代码测试、维护以及宏
- 使用Hibernate操作对象的时候报错【update一个对象报的错】