
贪心
S_Black
学生
展开
-
【CODEFORCES】 B. Appleman and Card Game
B. Appleman and Card Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman has n cards. Each card ha原创 2015-01-08 10:31:56 · 665 阅读 · 0 评论 -
【HDU】5303 Delicious Apples
Delicious Apples题目链接Delicious Apples题目大意 现在有一个长度为L的环,现在在这个环上某些位置有苹果树,每棵树上有若干个苹果,你现在家在原点,而且有一个容量为k的袋子,每次袋子装满苹果后就需要回家一次,我们现在需要计算:如果把所有苹果树上的苹果摘完,最短的路径是多少。题解贪心 枚举 首先我们可以看到苹果的总和不超过10510^5,所以我们可以把每个苹原创 2016-07-19 16:22:39 · 407 阅读 · 0 评论 -
【HDU】5744 Keep On Movin
Keep On Movin题目链接Keep On Movin题目大意 现在有一堆字符,要你用这些字符组成若干个回文串,使得这些回文串中最短的串长度最大。题解 因为注意到长度为奇数时,最中间需要一个串来连接左右两边,所以我们处理出所有的奇数串个数,然后平分偶数串个数即可。代码#include <iostream>#include <cstdio>#include <cstring>原创 2016-07-29 14:26:35 · 462 阅读 · 0 评论 -
【 HYSBZ】3668 起床困难综合症(NOI 2014)
起床困难综合症题目链接起床困难综合症题目大意 现在可以任选一个在0到m之间的数,给你n个位操作,从第一个操作到最后一个,要使最后的结果最大。题解贪心 从高位向低位贪心,枚举每一位是否为0或1,并判断是否在m的范围内,一直取到最后,记录结果就行。代码#include <iostream>#include <cstring>#include <cstdio>#define maxn原创 2016-07-13 12:59:04 · 448 阅读 · 0 评论 -
【HDU】5742 It's All In The Mind
It’s All In The Mind题目链接It’s All In The Mind题目大意 给你一个序列,非增,现在告诉你某些项的值,让你求如下式子的最大值 a1+a2∑ni=1ai \frac{a_1+a_2}{\sum_{i=1}^na_i}题解 保证前面的尽量大,后面的尽量小就行了。代码#include <iostream>#include <cstdio>#原创 2016-07-22 11:35:38 · 416 阅读 · 0 评论 -
【CODEFORCES】 B. Long Jumps
B. Long Jumpstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputValery is a PE teacher at a school in Berland.原创 2015-08-06 15:51:14 · 880 阅读 · 0 评论 -
【CODEFORCES】 A. Exams
A. Examstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputStudent Valera is an undergraduate student at the U原创 2015-08-03 16:52:18 · 555 阅读 · 0 评论 -
【CODEFORCES】 C. Kamal-ol-molk's Painting
C. Kamal-ol-molk's Paintingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRumors say that one of Kamal-ol原创 2015-07-18 19:24:07 · 677 阅读 · 0 评论 -
【CODEFORCES】 C. Table Decorations
C. Table Decorationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have r red, g green and b blue ba原创 2015-07-27 16:26:01 · 933 阅读 · 0 评论 -
【CODEFORCES】 B. Random Teams
B. Random Teamstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputn participants of the competition were split原创 2015-07-27 15:40:52 · 947 阅读 · 0 评论 -
【CODEFORCES】 B. Design Tutorial: Learn from Life
B. Design Tutorial: Learn from Lifetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne way to create a task原创 2015-07-09 11:31:27 · 625 阅读 · 0 评论 -
【CODEFORCES】 C. Design Tutorial: Make It Nondeterministic
C. Design Tutorial: Make It Nondeterministictime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA way to make原创 2015-07-09 11:34:42 · 790 阅读 · 0 评论 -
【CODEFORCES】C. Gargari and Bishops
C. Gargari and Bishopstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGargari is jealous that his friend C原创 2015-01-08 20:49:29 · 582 阅读 · 0 评论 -
【CODEFORCES】 C. Appleman and Toastman
C. Appleman and Toastmantime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman and Toastman play a game.原创 2015-01-08 14:59:55 · 596 阅读 · 0 评论 -
【HDU】5783 Divide the Sequence
Divide the Sequence题目链接Divide the Sequence题目大意 给定一个序列A,现在要把A分成尽量多的连续子序列,要求每段子序列的每段前缀和都大于0。题解贪心 算是这次的签到题把,注意是每段连续子序列的每段前缀和都要大于0(一开始还把这里看错了…),因为每段前缀和都要大于0且一定有解,所以对于每一个负数,它只可能与前面的数成一段,而对于一个正数,如果不需原创 2016-08-03 17:10:22 · 607 阅读 · 0 评论