![](https://img-blog.csdnimg.cn/20200408165451534.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
ICPC-贪心法
文章平均质量分 83
有关贪心法的题解
海岛Blog
这个作者很懒,什么都没留下…
展开
-
HDU2187 老人是真饿了【贪心】
老人是真饿了Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24419 Accepted Submission(s): 9946Problem Description… …假设下拨了一定数量的经费要去市场采购大米(散装)。如果市场有m种大米,各种大米的单价和重量已知,请问,为了满足更多灾民的需求,最多能采购多少重量的大米呢?Inpu原创 2022-04-24 19:19:39 · 302 阅读 · 0 评论 -
UVA1445 LA4636 POJ3802 Cubist Artwork【贪心】
Cubist ArtworkTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 477 Accepted: 308DescriptionInternational Center for Picassonian Cubism is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition原创 2021-08-01 19:08:51 · 234 阅读 · 0 评论 -
UVA434 Matty‘s Blocks【贪心】
Little Matty liked playing with his blocks very much. He always constructed his ‘buildings’ in the same way: he made stacks of one or more blocks, and he put those stacks on a square table that was exactly K blocks wide (K = 8 for hislargest table, so it原创 2021-08-01 10:16:11 · 202 阅读 · 2 评论 -
UVA10670 POJ1907 ZOJ2372 Work Reduction【贪心】
Work ReductionTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1784 Accepted: 631DescriptionPaperwork is beginning to pile up on your desk, and tensions at the workplace are starting to mount. Your boss has threatened to fire you if you don’原创 2021-06-21 10:48:23 · 190 阅读 · 0 评论 -
UVA13079 On the beach!【贪心】
When a summer apartment is advertised with a large On the beach!, hardly anyone believes that it will be true. Therefore, the owners of several apartment buildings (parallel to the beach but not on the beachfront) have decided to build underground passagew原创 2021-04-15 14:11:49 · 129 阅读 · 0 评论 -
POJ1089 Intervals【贪心】
IntervalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9961 Accepted: 3930DescriptionThere is given the series of n closed intervals [ai; bi], where i=1,2,…,n. The sum of those intervals may be represented as a sum of closed pairwise non−原创 2021-04-13 13:43:22 · 208 阅读 · 0 评论 -
HDU4864 Task【贪心】
TaskTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 16874 Accepted Submission(s): 4287Problem DescriptionToday the company has m tasks to complete. The ith task need xi minutes to complete. Mea原创 2021-04-13 13:16:59 · 199 阅读 · 0 评论 -
HDU3348 coins【贪心】
coinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3700 Accepted Submission(s): 1345Problem Description“Yakexi, this is the best age!” Dong MW works hard and get high pay, he has many 1 Jiao原创 2021-04-13 12:19:26 · 224 阅读 · 0 评论 -
HDU2546 饭卡【贪心+0-1背包】
饭卡Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 61781 Accepted Submission(s): 21084Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即原创 2021-04-12 05:38:22 · 341 阅读 · 0 评论 -
HDU1789 Doing Homework again【贪心】
Doing Homework againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24959 Accepted Submission(s): 14299Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a原创 2021-04-12 05:10:41 · 649 阅读 · 0 评论 -
UVA12321 Gas Stations【贪心】
G gas stations are authorized to operate over a road of length L. Each gas station is able to sell fuel over a specific area of influence, defined as the closed interval [x − r, x + r], where x is the station’s location on the road (0 ≤ x ≤ L) and r is its原创 2021-04-11 08:28:36 · 226 阅读 · 1 评论 -
UVA12405 Scarecrow【贪心】
Taso owns a very long field. He plans to grow different types of crops in the upcoming growing season. The area, however, is full of crows and Taso fears that they might feed on most of the crops. For this reason, he has decided to place some scarecrows at原创 2021-04-11 00:57:21 · 274 阅读 · 0 评论 -
UVA11389 The Bus Driver Problem【贪心】
In a city there are n bus drivers. Also there are n morning bus routes and n afternoon bus routes with various lengths. Each driver is assigned one morning route and one evening route. For any driver, if his total route length for a day exceeds d, he has t原创 2021-04-11 00:35:43 · 177 阅读 · 0 评论 -
UVA11624 Coin Collector【贪心】
Our dear Sultan is visiting a country where there are n different types of coin. He wants to collect as many different types of coin as you can. Now if he wants to withdraw X amount of money from a Bank, the Bank will give him this money using following al原创 2021-03-26 00:32:05 · 191 阅读 · 0 评论 -
UVA10382 Watering Grass【贪心】
n sprinklers are installed in a horizontal strip of grass l meters long and w meters wide. Each sprinkler is installed at the horizontal center line of the strip. For each sprinkler we are given its position as the distance from the left end of the center原创 2021-03-26 00:01:47 · 190 阅读 · 0 评论 -
POJ3045 Cow Acrobats【二分搜索+贪心】
Cow AcrobatsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9208 Accepted: 3408DescriptionFarmer John’s N (1 <= N <= 50,000) cows (numbered 1…N) are planning to run away and join the circus. Their hoofed feet prevent them from tightro原创 2021-03-03 22:12:20 · 324 阅读 · 2 评论 -
POJ3627 Bookshelf【贪心】
BookshelfTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9884 Accepted: 4933DescriptionFarmer John recently bought a bookshelf for cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top原创 2021-02-22 05:57:22 · 293 阅读 · 1 评论 -
POJ3663 Costume Party【贪心】
Costume PartyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16683 Accepted: 6648DescriptionIt’s Halloween! Farmer John is taking the cows to a costume party, but unfortunately he only has one costume. The costume fits precisely two cows wi原创 2021-02-22 05:56:31 · 230 阅读 · 0 评论 -
UVA10602 Editor Nottoobad【贪心】
Company Macrohard has released it’s new version of editor Nottoobad, which can understand a few voice commands. Unfortunately, there are only two voice commands that it can understand — “repeat the last word”, “delete the last symbol”. However, when one us原创 2021-02-15 08:53:07 · 232 阅读 · 0 评论 -
HDU2111 Saving HDU【贪心】
Saving HDUTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19418 Accepted Submission(s): 8509Problem Description话说上回讲到海东集团面临内外交困,公司的元老也只剩下...原创 2020-05-04 22:20:16 · 465 阅读 · 0 评论 -
HDU3794 Magic Coupon【贪心】
Magic CouponTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1818 Accepted Submission(s): 490Problem DescriptionThe magic shop in Mars is ...原创 2020-04-30 23:22:48 · 332 阅读 · 1 评论 -
HDU2570 迷瘴【贪心】
迷瘴Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18227 Accepted Submission(s): 5798Problem Description通过悬崖的yifenfei,又面临着幽谷的考验——幽谷周围瘴气弥漫...原创 2020-04-29 22:43:38 · 552 阅读 · 0 评论 -
UVA410 LA5494 POJ1599 HDU1607 Station Balance【贪心】
Station BalanceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 611 Accepted: 220 Special JudgeDescriptionThe International Space Station contains many centrifuges in its labs. Each ce...原创 2020-03-26 23:47:51 · 469 阅读 · 0 评论 -
UVA11369 POJ3637 HDU1678 Shopaholic【贪心】
ShopaholicTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5477 Accepted: 3161DescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items ...原创 2020-03-07 22:13:28 · 282 阅读 · 0 评论 -
UVA10700 Camel trading【贪心】
Aroud 800 A.D., El Mamum, Calif of Baghdad was presented the formula 1 + 2 ∗ 3 ∗ 4 + 5, which had its origin in the financial accounts of a camel transaction. The formula lacked parenthesis and was am...原创 2019-05-29 19:52:24 · 406 阅读 · 0 评论 -
POJ1700 Crossing River【贪心】
Crossing RiverTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 16966 Accepted: 6416DescriptionA group of N people wishes to go across a river with only o原创 2016-05-24 11:01:33 · 1628 阅读 · 0 评论 -
UVA10020 POJ2620 Minimal coverage【贪心】
Given several segments of line (int the X axis) with coordinates [Li, Ri]. You are to choose the minimal amount of them, such they would completely cover the segment [0, M].InputThe first line is th...原创 2019-05-29 23:28:27 · 620 阅读 · 0 评论 -
POJ3262 Protecting the Flowers【贪心】
Protecting the FlowersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8663 Accepted: 3501DescriptionFarmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as u...原创 2018-04-04 17:16:15 · 732 阅读 · 0 评论 -
UVA1062 UVALive3752 Containers【贪心】
A seaport container terminal stores large containers that are eventually loaded on seagoing ships for transport abroad. Containers coming to the terminal by road and rail are stacked at the terminal a...原创 2019-02-15 08:02:22 · 481 阅读 · 0 评论 -
HDU6188 Duizi and Shunzi【贪心】
Duizi and Shunzi Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2266 Accepted Submission(s): 895 Problem DescriptionNike li...原创 2018-07-14 22:24:02 · 723 阅读 · 0 评论 -
POJ2573 ZOJ1877 Bridge【贪心】
BridgeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4148 Accepted: 1420 Special JudgeDescriptionn people wish to cross a bridge at night. A group原创 2018-02-07 08:48:38 · 975 阅读 · 0 评论 -
HDU4004 The Frog's Games【贪心+二分搜索】
The Frog's GamesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 8250 Accepted Submission(s): 3871Problem DescriptionThe annual Ga原创 2018-02-05 09:14:00 · 844 阅读 · 0 评论 -
POJ2431 Expedition【贪心+优先队列】
ExpeditionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16324 Accepted: 4662DescriptionA group of cows grabbed a truck and ventured on an expedition d原创 2017-07-02 19:49:52 · 2165 阅读 · 0 评论 -
HDU2037 今年暑假不AC【贪心】
问题链接:HDU2037 今年暑假不AC。问题简述:参见上述链接。问题分析:典型的贪心算法题,分别用C语言和C++语言编写程序。若干个电视节目,自然要按时间顺序来看。为了看更多的节目,需要尽快看完一个节目再看另外一个节目,多看短节目才能看更多的节目。程序说明:C语言程序与C++语言程序的差别,只在排序方面,调用的函数与参数不同。AC的C语言程序如下:/* H原创 2016-07-09 20:44:11 · 9549 阅读 · 3 评论 -
UVALive6497 Digit Sum【贪心】
When Grace was in third grade, her elementary school teacher assigned her the following problem: What is the smallest possible sum of two numbers that together use the numerals 1, 2, 7, 8,and原创 2017-12-02 21:55:26 · 462 阅读 · 0 评论 -
HDU4268 Alice and Bob【贪心+SET】
Alice and BobTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4719 Accepted Submission(s): 1480Problem DescriptionAlice and Bob's gam原创 2017-07-25 09:40:38 · 1382 阅读 · 0 评论 -
AOJ0033 Ball【贪心+序列处理】
図のように二股に分かれている容器があります。1 から 10 までの番号が付けられた10 個の玉を容器の開口部 A から落とし、左の筒 B か右の筒 C に玉を入れます。板 D は支点 E を中心に左右に回転できるので、板 D を動かすことで筒 B と筒 C のどちらに入れるか決めることができます。開口部 A から落とす玉の並びを与えます。それらを順番に筒 B 又は筒 Cに入れていきます。このと原创 2017-05-29 11:36:48 · 1705 阅读 · 0 评论 -
UVA1368 UVALive3602 ZOJ3132 DNA Consensus String【贪心】
Regionals 2006 >> Asia - Seoul 问题链接:UVA1368 UVALive3602 ZOJ3132 DNA Consensus String问题简述:给定m个长度为n的DNA序列,求一个DNA序列,使其到所有这些序列的总hamming距离尽量小,如果有多个解,输出字典顺序的最小解。问题分析:每个DNA序列的长度相同,对每个DNA序列...原创 2016-08-01 14:06:56 · 1250 阅读 · 2 评论 -
UVA11729 Commando War【贪心】
问题链接:UVA11729 Commando War。问题简述:有n个部下需要完成一项任务,给第i个部下交代任务需要Bi时间,执行任务需要Ji时间,要求尽早完成任务,请输出最后完成任务需要的最小总时间。这个问题是一个典型的贪心法问题,求完成任务的最短时间。用C++编程比较方便。程序说明:程序中,比起用结构表示,每一项任务用一个类对象表示,程序处理起来比较方便,所以实现了一个原创 2016-08-04 20:04:38 · 1045 阅读 · 0 评论 -
UVA11292 HDU1902 POJ3646 The Dragon of Loowater【贪心】
问题链接:UVA11292 HDU1902 POJ3646 The Dragon of Loowater。题意简述:(略)问题分析:这个问题是一个典型的贪心法问题,求代价最小。由于需要用到排序函数,C++的排序函数参数比较简单,所以用C++编程。程序说明:(略)AC通过的C++语言程序如下:/* UVA11292 HDU1902 POJ364原创 2016-08-03 20:50:05 · 1291 阅读 · 0 评论