![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
sigh_
这个作者很懒,什么都没留下…
展开
-
Gym_102823A Array Merge(贪心)
Array Mergetime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionGiven two arrays AAA, BBB of length n and m separately, you have to merge them into only one array CCC (of length n+mn+mn+m) obeying the rule that the relativ原创 2020-12-19 19:48:32 · 589 阅读 · 2 评论 -
CodeForces_1461E Water Level(数论 + 贪心)
Water Leveltime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionIn recent years John has very successfully settled at his new job at the office. But John doesn’t like to idly sit around while his code is compiling, so he i原创 2020-12-12 16:07:34 · 442 阅读 · 1 评论 -
CodeForces_1456C New Game Plus!(贪心)
New Game Plus!time limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionWabbit is playing a game with n bosses numbered from 1 to n. The bosses can be fought in any order. Each boss needs to be defeated exactly once. There is a原创 2020-11-30 11:29:42 · 324 阅读 · 0 评论 -
Gym_102028B Ultraman vs. Aodzilla and Bodzilla(贪心)
Ultraman vs. Aodzilla and Bodzilla time limit per test:2 secondsmemory limit per test:1024 megabytesProblem DescriptionSix months ago our hero, formerly known as Huriyyah, was beating all monsters in the land. Now he changed his name to Ultraman and le原创 2020-10-22 13:35:36 · 267 阅读 · 0 评论 -
CodeForces_1419D Sage‘s Birthday(构造 + 贪心)
Sage’s Birthdaytime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionToday is Sage’s birthday, and she will go shopping to buy ice spheres. All nnn ice spheres are placed in a row and they are numbered from 111 to nnn from原创 2020-09-20 10:08:47 · 300 阅读 · 0 评论 -
CodeForces_1400E Clear the Multiset(分治)
Clear the Multisettime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou have a multiset containing several integers. Initially, it contains a1a_1a1 elements equal to 1, a2a_2a2 elements equal to 2, …, ana_nan element原创 2020-08-28 16:17:41 · 151 阅读 · 0 评论 -
CodeForces_1379C Choosing flowers(贪心)
Choosing flowerstime limit per test:1 secondsmemory limit per test:512 megabytesProblem DescriptionVladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly nnn flowers.Vladimir went to a flower sho原创 2020-07-21 18:08:38 · 418 阅读 · 0 评论 -
CodeForces_1385F Removing Leaves(贪心)
Removing Leavestime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given a tree (connected graph without cycles) consisting of nnn vertices. The tree is unrooted — it is just a connected undirected graph without c原创 2020-07-19 10:20:33 · 140 阅读 · 0 评论 -
CodeForces_1375E Sum of Digits(暴力+贪心)
Sum of Digitstime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionLet f(x)f(x)f(x) be the sum of digits of a decimal number x.Find the smallest non-negative integer xxx such that f(x)+f(x+1)+⋯+f(x+k)=nf(x)+f(x+1)+⋯+f(x+k)原创 2020-07-06 21:44:48 · 313 阅读 · 0 评论 -
洛谷_1686 挑战(贪心)
挑战题目链接:https://www.luogu.com.cn/problem/P1686题解:将起始点作为原点(0,0)(0,0)(0,0),每次移动后,坐标记为(xi,yi)(x_i,y_i)(xi,yi)。共n+1个点,因为捷径是直线,所以每个点只需要找到x相等或y相等的点。暂时只考虑x相等的状态,设当前共有k个点的x相等,y分别为y1,y2,...,yky_1,y_2,...,y_ky1,y2,...,yk。将y顺序排列,捷径一定是y1−>y2y_1->y_2y1−&原创 2020-06-25 14:13:59 · 186 阅读 · 0 评论 -
CodeForces_1370E Binary Subsequence Rotationv(贪心)
Binary Subsequence Rotationtime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionNaman has two binary strings sss and ttt of length nnn (a binary string is a string which only consists of the characters “0” and “1”). He wan原创 2020-06-21 13:52:36 · 440 阅读 · 0 评论 -
洛谷_1084 疫情控制(贪心+倍增+二分)
疫情控制题目链接:https://www.luogu.com.cn/problem/P1084题解:对答案进行二分,然后check在时限内,能否满足题目条件。(若军队数目小于1号节点的子节点数,则无解)check:显然在规定时间内,军队的移动越靠近根节点更好。所以可以先求出时限内,每支军队能移动到的最靠近根节点的位置,可以利用倍增快速计算。将所有能移动至根节点的军队标记为未驻扎状态,单独记录其到根节点已花费的时间,以及来自根节点的哪个子树。DFS判断根节点每个子节点所在子树是否满足要求,若不满足原创 2020-06-11 23:52:18 · 570 阅读 · 0 评论 -
POJ_2433 Landscaping(贪心)
LandscapingTime Limit: 1000MS Memory Limit: 65536KProblem DescriptionFarmer John is making the difficult transition from raising mountain goats to raising cows. His farm, while ideal for mountain...原创 2020-05-06 17:23:11 · 221 阅读 · 0 评论 -
ZOJ_3627 Treasure Hunt II(贪心)
Treasure Hunt IITime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionThere are n cities(1, 2, … ,n) forming a line on the wonderland. city i and city i+1 are adjacent and their distance is ...原创 2020-05-04 21:30:59 · 172 阅读 · 0 评论 -
CodeForces_1201D Treasure Hunting(贪心)
Treasure Huntingtime limit per test:3 secondsmemory limit per test:256 megabytesProblem DescriptionYou are on the island which can be represented as a n×mn×mn×m table. The rows are numbered from 1...原创 2020-04-11 10:45:12 · 137 阅读 · 0 评论