贪心
Gee_Zer
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Delivery Man(贪心)
一开始以为可以用优先队列写,每次选择小费最多的,结果WA,正确的贪心思想是按照两个数的差排序,然后每次选择小费最多的即可。代码如下:#include<bits/stdc++.h>#define LL long long#define Max 100005#define Mod 1e9+7const LL mod=1e9+7;const LL inf=0x3f3f3f3f...原创 2018-11-26 12:51:39 · 508 阅读 · 0 评论 -
Codeforces 154A
题目链接:154A题意:给你一个字符串,接下来给你n对字符,每对代表这两个字母有冲突不能相邻(一个字母只与不超过一个字母产生冲突),你可以删除某个字符来达到这个要求,现在问你最少需要删除多少个字符。思路:题目说了每个字母只与不超过一个字母产生冲突,所以可以知道n对字符串它们之间的解是独立的,接下来思考单独的一组,如果有连续的子字符串,全部由冲突字母构成,例如pg冲突,子字符串为pgppggg,...原创 2019-07-16 08:43:23 · 366 阅读 · 0 评论 -
CF 1082C. Multi-Subject Competition
C. Multi-Subject Competitiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA multi-subject competition is coming! The competition has m diff...原创 2019-04-29 19:44:16 · 247 阅读 · 0 评论 -
Codeforces 940 C. Phone Numbers
C. Phone Numberstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnd where the are the phone numbers?You are given a string s consisting of l...原创 2019-04-19 15:13:56 · 381 阅读 · 0 评论 -
I - Minimize the error CodeForces - 960B (贪心)
B. Minimize the errortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two arrays A and B, each of size n. The error, E, between t...原创 2019-04-18 10:35:16 · 220 阅读 · 0 评论 -
D - Liebig's Barrels CodeForces - 985C
C. Liebig’s Barrelstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have m = n·k wooden staves. The i-th stave has length ai. You have to ...原创 2019-04-16 11:29:58 · 477 阅读 · 0 评论 -
C. Coffee Break CodeForces - 1041C (贪心)
Recently Monocarp got a job. His working day lasts exactly m minutes. During work, Monocarp wants to drink coffee at certain moments: there are n minutes a1,a2,…,an, when he is able and willing to tak...原创 2019-04-11 17:29:06 · 470 阅读 · 0 评论 -
I - Heaters CodeForces - 1066B
B. Heaterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova’s house is an array consisting of n elements (yeah, this is the first problem, ...原创 2019-04-10 15:24:27 · 215 阅读 · 0 评论 -
入门OJ 3793: [Noip模拟题]剪草(贪心+DP)
题目链接:入门OJ3793Description有N棵小草,编号0至N-1。奶牛Bessie不喜欢小草,所以Bessie要用剪刀剪草,目标是使得这N棵小草的高度总和不超过H。在第0时刻,第i棵小草的高度是h[i],接下来的每个整数时刻,会依次发生如下三个步骤:(1)每棵小草都长高了,第i棵小草长高的高度是grow[i]。(2)Bessie选择其中一棵小草并把它剪平,这棵小草高度变为0。...原创 2019-03-20 10:29:48 · 417 阅读 · 0 评论 -
922 D. Robot Vacuum Cleaner
题目链接:922DD. Robot Vacuum Cleanertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPushok the dog has been chasing Imp for a few hours already....原创 2019-07-22 10:54:56 · 401 阅读 · 0 评论
分享