
贪心
文章平均质量分 77
Mr_Treeeee
这个作者很懒,什么都没留下…
展开
-
EOJ 3263 丽娃河的狼人传说(贪心)
丽娃河的狼人传说Time limit per test: 1.0 secondsTime limit all tests: 1.0 secondsMemory limit: 256 megabytes丽娃河是华师大著名的风景线。但由于学校财政紧缺,丽娃河边的路灯年久失修,一到晚上就会出现走在河边要打着手电的情况,不仅非常不方便,而且影响安全:已经发生了大大小小的原创 2017-05-13 22:38:50 · 444 阅读 · 0 评论 -
FZU 2111 - Min Number (贪心)
Problem 2111 Min NumberAccept: 983 Submit: 1927Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionNow you are given one non-negative integer n in 10-base notation原创 2017-11-15 15:40:38 · 304 阅读 · 0 评论 -
EOJ Monthly 2017.12 - C. 易位构词 (贪心)
C. 易位构词Time limit per test: 2.0 secondsMemory limit: 256 megabytes易位构词 (anagram),指将一个单词中的字母重新排列,原单词中的每个字母都出现有且仅有一次。例如 "unce" 可以被易位构词成 "ecnu"。在某些情况下,要求重排而成的依然是一个单词,但本题没有这种要求,因为我们根本没有词原创 2017-12-08 22:12:19 · 639 阅读 · 0 评论 -
2017 CCPC 秦皇岛 & ZOJ 3987 - Numbers (贪心+大数)
NumbersTime Limit: 2 Seconds Memory Limit: 65536 KBDreamGrid has a nonnegative integer . He would like to divide into nonnegative integers and minimizes their bitwise or (i.e. an原创 2017-12-19 23:26:44 · 471 阅读 · 0 评论 -
Codeforces Round #451 (Div. 2) - E. Squares and not squares (贪心)
E. Squares and not squarestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnn and Borya have n piles with原创 2017-12-21 22:57:00 · 339 阅读 · 0 评论 -
Educational Codeforces Round 14 - D. Swaps in Permutation (优先队列+并差集)
D. Swaps in Permutationtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation of the原创 2017-11-27 10:42:23 · 295 阅读 · 0 评论 -
HDU 5695 - Gym Class (拓扑排序+优先队列)
Gym ClassTime Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2108 Accepted Submission(s): 803Problem Description众所周知,度度熊喜欢各类体育活动。原创 2017-11-27 11:06:53 · 324 阅读 · 0 评论 -
AtCoder Beginner Contest 083 - D - Wide Flip(思维)
D - Wide FlipTime limit : 2sec / Memory limit : 256MBScore : 500 pointsProblem StatementYou are given a string S consisting of 0 and 1. Find the maximum integer K not greater t原创 2017-12-23 22:19:20 · 462 阅读 · 0 评论 -
2017年浙江中医药大学大学生程序设计竞赛 - D CC的神奇背包(贪心)
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld题目描述cc最近收到了好多礼物,对着满地大小不一的礼物,她想要一个包来装,于是dd就掏出了一个会说话的神奇背包给cc装礼物。cc为了一次性装尽可能多的礼物,于是跟这个背包定下了一个规则,对每个礼物,背包会给出它对这件礼物的原创 2017-12-24 19:57:01 · 604 阅读 · 0 评论 -
Codeforces Round #459 (Div. 2) - C. The Monster(贪心)
http://codeforces.com/contest/918/problem/C题意:给你一串?(),让你求有几组[l,r],l-r中的括号是匹配的。POINT:2 ≤ |s| ≤ 5000,可以遍历l,然后往前判断是否匹配。遇"(" , now++. ")",now--.先把"?"全部当成")",然后当temp如果没有?了那就break了。原创 2018-01-31 14:22:24 · 291 阅读 · 0 评论 -
第十四届浙江财经大学程序设计竞赛 - I-Interesting Set (贪心)
I-Interesting Setpoint:观察可知,只要字符串是0的位置变为1,后面的数字就是一个1、0任意的排列。这样,我们先从后开始找0,找到0,假设他为1,然后算一下有几个排列组合,如果<当前的k。那么k-=这个排列组合。在往前找。直到找到>=k的。然后问题就是当前位置(假设为n)的后面(len-n)个0、1排列要怎么排了。从前往后贪心假设,先假设为0,算一下排列组合,够了就...原创 2018-03-27 21:29:56 · 357 阅读 · 0 评论 -
第六届福建省赛 - H StarCraft (哈夫曼树思想)
题目题意:给你n个建筑和他们所需的建筑时间。初始给你m个人,有两个用途。1.去建建筑,花费他们所需的时间,然后死亡。2.去分裂成2个人,需要k个时间,然后死亡。问你建完所有建筑需要的最短时间。POINT:首先要知道的是,如果n>m时,我们恰好造出n个人是最优的。把人的关系想象成 多颗二叉树,每个叶子节点就是去建筑的人。如果多生了的话 , 这个多生了的数量 肯定能被二进制表示。能被二进制表示说...原创 2018-05-09 16:11:25 · 233 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第二场) - D money (贪心)
https://www.nowcoder.com/acm/contest/140/D 题目描述 White Cloud has built n stores numbered from 1 to n.White Rabbit wants to visit these stores in the order from 1 to n.The store numbered i has a...原创 2018-07-24 13:30:50 · 294 阅读 · 0 评论 -
2018 Multi-University Training Contest 1 - 1004 Distinct Values (贪心 set)
题目题意:给你m个区间,他的要求是这个区间内不能存在相同的字符。序列长度共为n,元素为1到n。问你符合要求的最小字典序的序列。 POINT:先给区间按L从小到大排序,可以先把1到n个元素全部放入set。然后开一个pre指针(假),每次跑到当前区间的L-1,在这之前的元素都可以返回set。遍历L-R区间,然后每次放set中的begin。 就这样贪心的放置。...原创 2018-07-24 22:10:14 · 205 阅读 · 0 评论 -
AtCoder Beginner Contest 103 - D Islands War (贪心)
题目 题意:给你n个点,他们1到n依次从左到右连接。问你m对数(A,B)。AB不能相连。问你最少要拆多少条边. POINT:O(m)的做法:记录每一个左端点,与他有争议的最近的右端点。记为a数组(可以贪心的知道断每一个右端点是最优的)。那么假设断的是a[1],如果往后扫的有争议的右端点(比如a[2])比a[1]大,那么就只要断a[1]就行了。如果比a[1]小...原创 2018-07-22 13:42:09 · 508 阅读 · 0 评论 -
Educational Codeforces Round 30 - C. Strange Game On Matrix(贪心)
C. Strange Game On Matrixtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan is playing a strange game.原创 2017-10-13 22:19:12 · 370 阅读 · 0 评论 -
Educational Codeforces Round 31 - D. Boxes And Balls (哈夫曼树)
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan has n different boxes. The first of them contains some ball原创 2017-10-30 23:00:12 · 583 阅读 · 0 评论 -
HDU 1050 Moving Tables (两种思路)
Moving TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35145 Accepted Submission(s): 11559Problem DescriptionThe famous原创 2017-05-07 18:54:52 · 276 阅读 · 0 评论 -
HDU 5813 Elegant Construction (贪心)
Elegant ConstructionTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1034 Accepted Submission(s): 543Special JudgeProblem Descript原创 2017-07-15 21:36:01 · 249 阅读 · 0 评论 -
HDU 6047 Maximum Sequence (贪心)
Maximum SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 452 Accepted Submission(s): 242Problem DescriptionSteph is ex原创 2017-07-27 22:21:51 · 1038 阅读 · 0 评论 -
HDU 5821 Ball(贪心)
BallTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1074 Accepted Submission(s): 645Problem DescriptionZZX has a sequence of原创 2017-07-18 19:55:46 · 284 阅读 · 0 评论 -
HDU 5802 Windows 10 (贪心+DFS)
Windows 10Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2179 Accepted Submission(s): 659Problem DescriptionLong long ago, t原创 2017-07-11 22:11:02 · 358 阅读 · 0 评论 -
HDU 6178 Monkeys (贪心+输入挂)
MonkeysTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 153428/153428 K (Java/Others)Total Submission(s): 934 Accepted Submission(s): 311Problem DescriptionThere is a tree ha原创 2017-08-27 21:21:01 · 461 阅读 · 2 评论 -
Educational Codeforces Round 29 - B. Kayaking
B. Kayakingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVadim is really keen on travelling. Recently he原创 2017-10-02 20:20:37 · 719 阅读 · 0 评论 -
HDU 5933 - ArcSoft's Office Rearrangement (贪心)
ArcSoft's Office RearrangementTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2455 Accepted Submission(s): 826Problem Description原创 2017-10-27 12:50:33 · 329 阅读 · 0 评论 -
Codeforces Round #437 (Div. 2) - C. Ordering Pizza(贪心)
C. Ordering Pizzatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's another Start[c]up finals, and that原创 2017-10-10 23:15:37 · 623 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2) - C. Bus (贪心)
C. Bustime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA bus moves along the coordinate line Ox from the po原创 2017-10-04 22:41:48 · 359 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2) - D. Make a Permutation!(贪心)
D. Make a Permutation!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan has an array consisting of n el原创 2017-10-04 22:49:18 · 302 阅读 · 0 评论 -
HDU 5935 - Car(贪心)
CarTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2701 Accepted Submission(s): 728Problem DescriptionRuins is driving a car原创 2017-10-27 17:07:52 · 273 阅读 · 0 评论 -
Codeforces Round #433 (Div. 2) - C. Planning(贪心+链表)
C. Planningtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputHelen works in Metropolis airport. She is respon原创 2017-10-12 20:39:12 · 360 阅读 · 0 评论 -
Codeforces Round #193 (Div. 2) - C. Students' Revenge(贪心)
C. Students' Revengetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA student's life is fraught with compl原创 2017-10-22 15:56:37 · 425 阅读 · 0 评论 -
AtCoder Beginner Contest 109 - D - Make Them Even (贪心)
https://abc109.contest.atcoder.jp/tasks/abc109_d 题意:给你一个n*m的矩阵,你可以让一个元素-1,然后选择一个和他相临(上下左右)的元素+1。每个元素只能减一次。问你进行任意次操作后,矩阵中偶数元素最多。输出操作次数,和具体操作过程。 POINT:如果只有一行,那么很简单,从左到右扫,如果是奇数,那么往右边+1.,自...原创 2018-09-13 14:09:41 · 446 阅读 · 0 评论