
贪心
文章平均质量分 81
码代码的猿猿的AC之路
人一我百,人十我万追逐青春的梦想,怀着自信的心,永不放弃
展开
-
SRM 608 div2 500 MysticAndCandiesEasy
Problem Statement TopCoder admin mystic_tc is sitting in front of a table. He found N sealed boxes of candies on the table.He is not sure how many candies each box contains. However, he原创 2014-02-08 22:36:00 · 1441 阅读 · 0 评论 -
HDOJ 4671 Backup Plan 构造优先队列
优先队列构造前两列....Backup PlanTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 775 Accepted Submission(s): 365Special JudgeProblem原创 2014-11-22 23:47:58 · 1018 阅读 · 0 评论 -
Codeforces 484A. Bits 贪心
A. Bitstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's denote as the number of bits set ('1' bits)原创 2014-11-07 18:41:06 · 1310 阅读 · 0 评论 -
Codeforces Round #277.5 (Div. 2) JAVA版题解
Codeforces Round #277.5 (Div. 2)A. SwapSorttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output原创 2014-11-25 00:38:58 · 2187 阅读 · 0 评论 -
Codeforces 509C. Sums of Digits 贪心枚举
贪心枚举,代码里的注释很详细C. Sums of Digitstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya had原创 2015-02-06 20:50:45 · 1688 阅读 · 0 评论 -
Codeforces 520D. Cubes 贪心模拟
每一步都取当前稳定的格子里面数字最大或者最小的数.用一个set维护当前可取的格子 *begin 最大 *(--end) 最小每删除一个格子都要对这个格子周围的6个格子进行稳定性检查一个格子上面的3个格子确定了这个格子的稳定性D. Cubestime limit per test3 secondsmemory limit pe原创 2015-03-04 17:44:04 · 1687 阅读 · 0 评论 -
Codeforces 484D. Kindergarten DP贪心
贪心的选择单调的序列进行划分dp处理拐点(gd)应该分到左边的单调序列还是右边的单调序列大量读入加输入挂D. Kindergartentime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputou原创 2015-03-10 23:13:10 · 1040 阅读 · 0 评论 -
Codeforces 491B. New York Hotel 最远曼哈顿距离
最远曼哈顿距离有两个性质:1: 对每个点(x,y) 分别计算 +x+y , -x+y , x-y , -x-y 然后统计每种组合的最大值就可以了, 不会对结果产生影响2: 去掉绝对值 , 设正号为0负号为1 则 两个点的符号是可以通过异或的得到的. 如两个点 P(x,y) 和 Q(a,b) 若去掉绝对值符号后P的两个坐标为 -x +y 既对应数字 10 那么Q对应的数字则为 01原创 2015-03-13 21:53:25 · 1274 阅读 · 0 评论 -
Codeforces 496E. Distributing Parts 排序+贪心
将歌曲按低音从小到大排序,歌手也按低音从小到大排序.对每首歌曲,在一个SET中查找低音满足条件的而高音刚好满足条件的歌手E. Distributing Partstime limit per test2 secondsmemory limit per test256 megabytesinputstandard i原创 2015-03-24 22:46:27 · 1313 阅读 · 0 评论 -
Codeforces 527D. Clique Problem 贪心
点转换成线段,然后简单贪心.....CF里神奇的贪心比较多.....D. Clique Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outpu原创 2015-04-10 11:07:13 · 1230 阅读 · 0 评论 -
Codeforces 549G. Happy Line 贪心
很有意思的贪心:Let's reformulate the condition in terms of a certain height the towers, which will be on the stairs. Then an appropriate amount of money of a person in the queue is equal to the hei原创 2015-06-09 00:44:50 · 2270 阅读 · 0 评论 -
HDOJ 5335 Walk Out 贪心+BFS
BFS沿着0走,记录下最靠近终点的1然后斜着扫描Walk OutTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2573 Accepted Submission(s): 506Problem D原创 2015-08-01 21:22:28 · 742 阅读 · 0 评论 -
ZOJ 2702 Unrhymable Rhymes 贪心
贪心,能凑成一组就算一组Unrhymable RhymesTime Limit: 10 Seconds Memory Limit: 32768 KB Special JudgeAn amateur poet Willy is going to write his first abstract poem. Since abstract art原创 2014-11-02 22:43:08 · 1069 阅读 · 0 评论 -
HDOJ 5073 Galaxy 数学 贪心
贪心:保存连续的n-k个数,求最小的一段方差。。。。预处理O1算期望。。。GalaxyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 752 Accepted Submission(s): 176原创 2014-10-23 14:46:58 · 1216 阅读 · 0 评论 -
ZOJ 2710 Two Pipelines
贪心。。。。Two PipelinesTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeThere are two oil pipelines going through Flatland. Each pipeline can be considered as a line on原创 2014-02-22 18:51:10 · 1214 阅读 · 0 评论 -
Codeforces 398 A. Cards
枚举a分成多少段,让a的部分尽量大,b的部分尽量小A. Cardstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUser ainta原创 2014-03-05 21:50:58 · 1398 阅读 · 0 评论 -
Codeforces 427E. Police Patrol
从两头开始取+在中位数上建巡逻站E. Police Patroltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImagine tha原创 2014-05-05 17:31:32 · 2105 阅读 · 0 评论 -
Codeforces 448 C. Painting Fence
递归,分治。。。C. Painting Fencetime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputBizon the Champion原创 2014-07-18 11:43:11 · 1541 阅读 · 0 评论 -
Codeforces 435B. Pasha Maximizes
简单贪心....B. Pasha Maximizestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPasha has a posit原创 2014-06-11 11:44:53 · 1539 阅读 · 0 评论 -
HDOJ 4882 ZCC Loves Codefires
ZCC Loves CodefiresTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 198 Accepted Submission(s): 105Problem DescriptionThough Z原创 2014-07-24 21:32:16 · 951 阅读 · 0 评论 -
HDOJ 5000 Clone
所有满足的情况的属性和是一定的,而且属性和等于sum/2时得到的结果最大.CloneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 574 Accepted Submission(s): 277原创 2014-09-18 21:27:15 · 1167 阅读 · 0 评论 -
HDOJ 4923 Room and Moor
用一个栈维护b的值,每次把一个数放到栈顶。看栈首的值是不是大于这个数,如果大于的话将栈顶2个元素合并,b的值就是这两个栈顶元素的平均值。。。Room and MoorTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s):原创 2014-08-10 15:23:45 · 943 阅读 · 0 评论 -
HDOJ 4915 Parenthese sequence
Parenthese sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 716 Accepted Submission(s): 335Problem Descriptionbobo f原创 2014-08-12 09:52:55 · 1110 阅读 · 0 评论 -
HDOJ 5037 Frog
FrogTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 634 Accepted Submission(s): 152Problem DescriptionOnce upon a time, the原创 2014-09-22 14:31:59 · 1320 阅读 · 0 评论 -
Codeforces 67A. Partial Teacher
贪心A. Partial Teachertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA teacher decides to gi原创 2014-09-03 21:43:39 · 943 阅读 · 0 评论 -
HDOJ 4268 Alice and Bob 贪心
按x和y排序后,贪心从y大的覆盖 用mulitset维护下即可….Alice and BobTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3817 Accepted Submission(s): 1198Problem Des原创 2015-09-07 21:12:32 · 662 阅读 · 0 评论