HOJ 3200
来源:互联网 发布:怎么进入淘宝客买东西 编辑:程序博客网 时间:2024/06/06 18:09
上周小测的ProblemE,也是我小测一塌糊涂的罪魁祸首。不不不,不是题目难,而是我居然写出了自己一个小时都没看出来的Bug。。。导致全盘崩。。。下次一定要好好写,不能乱写。
传送门:http://acm.hit.edu.cn/hojx/showproblem/3200/
3200 - No Game School
Time limit : 2 s Memory limit : 64 mb
Submitted : 21 Accepted : 13
Submit
Problem Description
BGod is a college student who love computer games, but unfortunately his school just published a rule that Games should disappear in the campus , that means nobody can play computer games in school, including the students dormitory. However, the student don’t take it seriously, that’s why the manager of the school gets so angry that he decided to go to the dormitory to punish the students. You should know the manager any punish those students who is playing games at the moment he enter the room, and leave immediately if nobody is playing game in this room.
BGod is a talented game player , in fact, he is the Carry of a famous Gaming club, so he needs time to practice he’s skills . And luckily , BGod’s roommate PY is a Geek(also a BGod fan), he hacked the manager’s computer and get the timetable of the manager, and tell BGod when will the manager come to their room tomorrow. A big E-sport Event is around the corner, so BGod list m skills he should practice, each skill takes some time to practice and improve BGod’s skill by some points. You should calculate the max total improvement points BGod can get. Note any skills can be practiced any times , including 0.
Input
The first line contains a integer T ( T <= 10 ), then T cases follows.
In each case, there are 3 parts of input.
The first part contains 3 integers L, n, m in a single line.Range[0, L] is the time BGod decide to practice , n is the times manager would enter his room, m indicate the total number of the skills.
The second part contains n integers ti(0 <= ti <= L) in a single line, means the manager would enter his room at ti. Note that ti is giving in the increasing order.
The third part has m lines , each line contains two integers ci(ci <= m), vi(vi <= 200), means this skill needs ci minutes to practice and can make vi points improvement.
L <= 500
n <= 10
m <= 100
Output
For each case, you should output the max points BGod can improve.
Sample Input
2
6 1 3
3
2 3
2 4
2 5
6 2 3
2 4
2 3
2 4
2 5
Sample Output
10
15
Hint
Note that BGod will be catch playing games any in the interval of his practicing, excluded the beginning and the ending of each practice time.
Sample 1:
Sample 2
题目大意就是:大神喜欢玩游戏,导员不给玩游戏。(怎么好像和某校情况相同(逃
然后有神队友助攻,帮他搞定导员来的时间,他只要在导员不来的时候玩游戏就好了。
而且他可以点任何一个技能点,没有次数限制(怎么还猥琐发育。。。
所以是物品是完全的。
那么,每个导员来的前后间隔可以视为一个背包,每个背包视为完全背包。
AC代码如下:
#include <stdio.h>#include <string.h>#define maxm 505 int dp[maxm];int MAX(int a, int b){ return a > b ? a : b;}struct p{ int c, v;} ps[maxm];int t[20];int main(){ int kase; scanf("%d", &kase); while(kase--) { int l, n, m; scanf("%d %d %d", &l, &n, &m); t[0] = 0; for(int i = 1; i <= n; i++) { scanf("%d", &t[i]); } t[n+1] = l; for(int i = 1; i <= m; i++) scanf("%d %d", &ps[i].c, &ps[i].v); int point = 0; for(int h = 0; h <= n+1; h++) { int v = t[h+1] - t[h]; memset(dp, 0, sizeof(dp)); for(int i = 1; i <= m; i++) { for(int j = ps[i].c; j <= v; j++) { dp[j] = MAX(dp[j], dp[j-ps[i].c] + ps[i].v); } } point = point + dp[v]; } printf("%d\n", point); } return 0;}
- HOJ 3200
- HOJ
- HOJ 3200 No Game School(多个完全背包)
- HOJ 1004
- 位图-hoj
- HOJ 1020
- HOJ Megaminx
- hoj WERTYU
- hoj 12033
- HOJ-2277
- HOJ-1962
- hoj 1408
- hoj 1006
- hoj 1138
- hoj 1999
- hoj(1797)
- Hoj 2012
- hoj 1556
- 交换机S5720外网断开两次(12月1日,11月27日),关闭auto-port-defend功能,仅开启auto-defend。针对信任的IP,acl放通,然后在策略里面调用ACL
- 剑指offer—二进制中1的个数
- 牛客练习赛7 题解
- ceph recovery 参数调研
- 10个黄金规则教你设计出优秀字体
- HOJ 3200
- UE4 打包出错 try catch
- 刷题笔记:牛客字符串专项练习7
- hdoj 1008 elevator
- 【传智播客郑州分享】本科生在传智播客郑州校区开启人生新篇章
- mysql 5.6 order by limit 排序分页数据重复问题
- appium-TouchAction
- Bootstrap Paginator 分页插件
- halcon例程学习笔记(10)---图像灰度共生矩阵cooc_feature_image.hdev