![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
文章平均质量分 72
王八变成汤
这个作者很懒,什么都没留下…
展开
-
喷水装置(贪心)
https://loj.ac/p/10002长 L 米,宽 W 米的草坪里装有 n 个浇灌喷头。每个喷头都装在草坪中心线上(离两边各 W/2 米)。我们知道每个喷头的位置(离草坪中心线左端的距离),以及它能覆盖到的浇灌范围。请问:如果要同时浇灌整块草坪,最少需要打开多少个喷头?输入格式输入包含若干组测试数据。第一行一个整数 T 表示数据组数;每组数据的第一行是整数 n、L 和 W;接下来的 n 行,每行包含两个整数,给出一个喷头的位置和浇灌半径(上面的示意图是样例输入第一组数据所描述的情况)原创 2022-03-01 20:57:53 · 687 阅读 · 0 评论 -
种树(贪心)
https://loj.ac/p/10001题目描述某条街被划为 n 条路段,这 n 条路段依次编号为1…n 。每个路段最多可以种一棵树。现在居民们给出了 h 组建议,每组建议包含三个整数 b,e,t,表示居民希望在路段 b 到 e 之间至少要种 t 棵树。这些建议所给路段的区间可以交叉。请问:如果要满足所有居民的建议,至少要种多少棵树。输入格式第一行为 n,表示路段数。第二行为 h,表示建议数。下面 h 行描述一条建议:b,e,t,用一个空格分隔。输出格式输出只有一个数,为满足所有居民原创 2022-03-01 20:02:50 · 176 阅读 · 0 评论 -
Crossing River (模拟+贪心)
A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the boat back and forth so that all people may cross. Each person has a dif原创 2021-09-03 18:13:10 · 364 阅读 · 0 评论 -
Cleaning Shifts (清洁班) 贪心算法(最小区间覆盖问题)
** Cleaning Shifts **Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day into T shifts (1 <= T <= 1..原创 2021-07-20 20:35:17 · 259 阅读 · 0 评论 -
Ice Cave (bfs,队列)冰面从一点到另一点
Ice CaveYou play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is原创 2021-07-20 19:02:51 · 107 阅读 · 0 评论 -
动态规划 贪心
标题 楼梯与电梯交换互乘;You are planning to buy an apartment in a nn-floor building. The floors are numbered from 11 to nn from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor.Let:原创 2021-05-28 21:46:32 · 72 阅读 · 0 评论 -
优先队列+贪心
A group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck’s fuel tank. The truck now leaks one unit of fuel every unit of distance原创 2021-05-21 10:44:22 · 258 阅读 · 0 评论