poj 2376 Cleaning Shifts 最小区间覆盖】的更多相关文章

Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40751   Accepted: 9871 Description 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 co…
<pre name="code" class="html"> Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14425   Accepted: 3700 Description Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleani…
POJ 2376 Cleaning Shifts(轮班打扫) Time Limit: 1000MS   Memory Limit: 65536K [Description] [题目描述] 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 clean…
http://poj.org/problem?id=2376 Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12604   Accepted: 3263 Description Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn.…
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,000,000…
http://poj.org/problem?id=2376 题目大意: 给你一些区间的起点和终点,让你用最小的区间覆盖一个大的区间. 思路: 贪心,按区间的起点找满足条件的并且终点尽量大的. 一开始排序还考虑了起点一样终点要大的,想了想没必要,因为只后都是直接扫描满足条件的.. 注意的是比如[4.5]下一次可以直接[6,10]这样...这一步坑了我好久... 后来一直WA,改了老半天...发现是大于等于少写了个等号,,,我去面壁...我要蹲墙角... #include<cstdio> #in…
题意:给定1-m的区间,然后给定n个小区间,用最少的小区间去覆盖1-m的区间,覆盖不了,输出-1. 析:一看就知道是贪心算法的区间覆盖,主要贪心策略是把左端点排序,如果左端点大于1无解,然后, 忽略小于1的部分(如果有的话),再找最长的区间,然后把这个区间的右端点作为下次寻找的起点, 再找最大区间,直到覆盖到最后. 注意:首先要判断好能不能覆盖,不能覆盖就结束,有可能会提前结束,也要做好判断,我就在这WA了好几次, 悲剧...其他的就比较简单了,不用说了. 代码如下: #include <ios…
Cleaning Shifts 题目连接: http://poj.org/problem?id=2376 Description 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…
题目地址: http://poj.org/problem?id=2376 题目内容: Cleaning Shifts Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12226   Accepted: 3187 Description Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores arou…
Description Farmer John <= N <= ,) cows to <= T <= ,,), the first being shift and the last being shift T. Each cow is only available at some interval of times during the day for work on cleaning. Any cow that is selected for cleaning duty will…