![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
zoe_ed
这个作者很懒,什么都没留下…
展开
-
LightOJ 1166 Old sorting(贪心/模拟?)
题意: 现有标号1到n的数,随机排列。可以进行两两交换,最后使这个数列升序排列。要求交换次数最少。因为是朝着贪心那个方向去想有点先入为主的感觉,所以一开始用O(N)的方法贪错了,wa了。 思路:每个元素都需要回到的位置是确定,所以从左到右依次还原每个位置上的元素就好。 为什么这样是对的呢? 交换次数一定是小于等于n的,之所以会有小于的情况是因为如果两个元素刚好在最对方的位置上就只用交换1次。原创 2015-11-24 19:31:12 · 361 阅读 · 0 评论 -
LightOJ 1396 Palindromic Numbers (III)(贪心)
Description Vinci is a little boy and is very creative. One day his teacher asked him to write all the Palindromic numbers from 1 to 1000. He became very frustrated because there is nothing creative i原创 2015-11-28 14:53:16 · 489 阅读 · 0 评论 -
POJ 3416 Sunscreen(贪心)
Sunscreen Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5778 Accepted: 2022 DescriptionTo avoid unsightly burns while tanning, each of the C (1 ≤ C ≤ 2500) cows must cover her原创 2016-01-19 20:16:58 · 804 阅读 · 0 评论 -
POJ2376Cleaning 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 s原创 2016-07-19 14:58:32 · 584 阅读 · 0 评论 -
惠民工程(最小生成树裸题)
惠民工程 Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu SubmitStatus Description 市政府“惠民工程”的目标是在全市n个居民点间之架设煤气管道(但不一定有直接的管道相连,只要能间接通过管道可达即可)。很显然最多可架设 n(n-1)/2条管道,然而实际上要连通n个居民原创 2016-10-27 23:30:21 · 677 阅读 · 0 评论 -
HDU - 6047 多校2 1003 Maximum Sequence (贪心+优先队列)
Steph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too easy for such a genius l原创 2017-07-28 11:06:26 · 232 阅读 · 0 评论