WHU 1537 Stones I】的更多相关文章

题目见: http://acm.whu.edu.cn/land/problem/detail?problem_id=1537 这个题相当无语,学长给的解法是:枚举取的个数k,然后对每个k贪心,取其中的最大值. 我想思路应该是这样:结果与选取的顺序无关,只和最终选取的数量有关. 所以,就枚举最终选取的数量k,在这种情况下,每个物品的价值就是固定的. 所以,在这种情况下,最优策略就一定是选取价值最大的前k个. 代码: #include <cstdio> #include <cstring&g…
赛后写的,动态规划,学长和题解,提供了两种状态设计的思路,都写了下……结果在写第二种的时候,不小心把下标的起点写错了,导致WA了无数发…… 无奈啊……每次都是这种错误…… 题意: 大概就是有n块石头,每块石头有两个值ai和bi,其中ai是价值.要求你从中选任意块,获得的价值最大. 但是,每当你选了一块石头,此时没有被你选到得石头的价值都会剪掉这块石头的bi. 思路: 首先,可以证明,如果被选,bi小的肯定被先选.因为,如果某两块石头,bi大的先选了:那么交换这两块石头的选取顺序,可以得到更大的价…
题目链接: http://acm.whu.edu.cn/land/problem/detail?problem_id=1537 Stones I Time Limit: 1000MSMemory Limit: 65536KB 问题描述 Xiaoming took the flight MH370 on March 8, 2014 to China to take the ACM contest in WHU. Unfortunately, when the airplane crossing t…
题目链接: http://acm.whu.edu.cn/land/problem/detail?problem_id=1538 Problem 1538 - B - Stones II Time Limit: 1000MSMemory Limit: 65536KB 问题描述 Xiaoming took the flight MH370 on March 8, 2014 to China to take the ACM contest in WHU. Unfortunately, when the…
Problem 1538 - B - Stones IITime Limit: 1000MS Memory Limit: 65536KB Total Submit: 416 Accepted: 63 Special Judge: No DescriptionXiaoming took the flight MH370 on March 8, 2014 to China to take the ACM contest in WHU. Unfortunately, when the airplane…
bzoj 1537: [POI2005]Aut- The Bus 先把坐标离散化 设f[i][j]表示从(1,1)走到(i,j)的最优解 这样直接dp::: f[i][j] = max{f[i-1][j] + f[i][j-1]} + w[i][j]就可以完美的MLE + TLE了 我们发现f[i][j]中,只有有权的点才有意义,但是我们只有10^5个有用的点,却考虑了10^5 * 10^5个点 所以我们只考虑有权的点,那么可以发现, f[i][j]的更新一定是由f(1,1)~(i,j)的最大值…
题目链接: 1537 分解  问(1+sqrt(2)) ^n  能否分解成 sqrt(m) +sqrt(m-1)的形式  如果可以 输出 m%1e9+7 否则 输出no Input 一行,一个数n.(n<=10^18) Output 一行,如果不存在m输出no,否则输出m%1e9+7 Input示例 2 Output示例 9 题意: 思路: 发现跟奇数偶数有关系,然后就找出递推式,然后就快速幂,然后就A了; AC代码: #include <iostream> #include <c…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5973 Game of Taking Stones Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) 问题描述 Two people face two piles of stones and make a game. They take turns to take stones. As ga…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A few naked children throw stones standing on the same position, the one throws farther win the game. Aha, of course, there are some naughty boys who care…
Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones are fake and which ones are no…