
贪心
贪心
繁星蓝雨
Happy coding!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
第七届蓝桥杯C++B组:交换瓶子
有N个瓶子,编号 1 ~ N,放在架子上。比如有5个瓶子:2 1 3 5 4要求每次拿起2个瓶子,交换它们的位置。经过若干次后,使得瓶子的序号为:1 2 3 4 5对于这么简单的情况,显然,至少需要交换2次就可以复位。如果瓶子更多呢?你可以通过编程来解决。输入格式为两行:第一行: 一个正整数N(N<10000), 表示瓶子的数目第二行:N个正整数,用空格分...原创 2019-03-16 11:02:52 · 377 阅读 · 0 评论 -
1067 Sort with Swap(0, i) (25 分)
Given any permutation(排列) of the numbers {0, 1, 2,...,N−1}, it is easy to sort them in increasing order. But what ifSwap(0, *)is the ONLY operation that is allowed to use? For example, to sort {...原创 2019-03-09 10:27:42 · 234 阅读 · 0 评论 -
1023 组个最小数 (20 分)
给定数字 0-9 各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意 0 不能做首位)。例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就是 10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:输入在一行中给出 10 个非负整数,顺序表示我们拥有数字 0、数字 1、……数字 9 的个数。整数间用一...原创 2019-03-08 15:34:53 · 519 阅读 · 0 评论 -
1070 Mooncake (25分)
文章目录1 题目2 解析2.1 题意2.2 思路3 参考代码1 题目1070 Mooncake (25分)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in trad...原创 2020-03-01 09:50:14 · 375 阅读 · 0 评论 -
1038 Recover the Smallest Number (30 分)
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0...原创 2019-03-09 11:11:43 · 325 阅读 · 0 评论 -
1033 To Fill or Not to Fill (25 分)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tankcapacity(油罐容量) of a car is limited, we have to find gas stations on the way from time to time. Differ...原创 2019-03-08 20:33:52 · 406 阅读 · 0 评论 -
1037 Magic Coupon (25 分)
The magic shop in Mars is offering some magic coupons(优惠卷). Each coupon has an integerNprinted on it, meaning that when you use this coupon with a product, you may getNtimes the value of that prod...原创 2019-03-08 22:42:31 · 577 阅读 · 0 评论