
贪心
衛宮
I will be back
展开
-
Radar Installation
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, loc原创 2018-01-24 19:39:32 · 141 阅读 · 0 评论 -
三值排序
排序是一种很频繁的计算任务。一个实际的例子是,当我们给某项竞赛的优胜者按金银铜牌排序的时候。在这个任务中可能的值只有三种1,2和3。我们用交换的方法把他排成升序的。写一个程序计算出,计算出的一个包括1、2、3三种值的数字序列,排成升序所需的最少交换次数。输入第1行为类别的数量N(1≤N≤1000)输入第2行到第N+1行,每行包括一个数字(1或2或3)。输出包含一行,为排成升序所需的最少交换次数。样...原创 2018-02-27 16:50:37 · 444 阅读 · 0 评论 -
Aggressive cows
/* 挺水的贪心, 关键之处在于STL式的upper_bound贪心思路 另外check函数的第一个虚拟地址, 也是比较好理解的 */ #include <algorithm> #include <functional> #include <string> #include <vector> #include <queue> #inclu...原创 2018-03-12 19:48:47 · 388 阅读 · 0 评论 -
poj 3617 Best Cow Line
DescriptionFJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The con...原创 2018-04-28 20:37:18 · 124 阅读 · 0 评论 -
[NOIp2015, 洛谷P2678]跳石头
题目背景 一年一度的“跳石头”比赛又要开始了! 题目描述 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石。组委会已经选择好了两块岩石作为比赛起点和终点。在起点和终点之间,有 NN 块岩石(不含起点和终点的岩石)。在比赛过程中,选手们将从起点出发,每一步跳向相邻的岩石,直至到达终点。 为了提高比赛难度,组委会计划移走一些岩石,使得选手们在比赛过程中的最短跳跃距离尽可能长。由于预算...原创 2018-08-01 14:47:17 · 182 阅读 · 0 评论