随笔分类 -  算法基础—贪心

摘要:You are playing another computer game, and now you have to slay nn monsters. These monsters are standing in a circle, numbered clockwise from 11 to nn 阅读全文
posted @ 2020-04-12 16:26 脂环 阅读(322) 评论(0) 推荐(1) 编辑
摘要:Many years ago Berland was a small country where only nn people lived. Each person had some savings: the ii -th one had aiai burles. The government co 阅读全文
posted @ 2020-04-11 11:48 脂环 阅读(323) 评论(0) 推荐(0) 编辑
摘要:Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem: There are two arrays of integers a 阅读全文
posted @ 2020-04-09 13:16 脂环 阅读(306) 评论(0) 推荐(0) 编辑
摘要:Dreamoon likes coloring cells very much. There is a row of nn cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 阅读全文
posted @ 2020-04-05 01:21 脂环 阅读(342) 评论(0) 推荐(1) 编辑
摘要:There is a frog staying to the left of the string s=s1s2…sns=s1s2…sn consisting of nn characters (to be more precise, the frog initially stays at the 阅读全文
posted @ 2020-03-29 00:35 脂环 阅读(371) 评论(0) 推荐(0) 编辑
摘要:The round carousel consists of nn figures of animals. Figures are numbered from 11 to nn in order of the carousel moving. Thus, after the nn -th figur 阅读全文
posted @ 2020-03-27 23:56 脂环 阅读(196) 评论(0) 推荐(0) 编辑
摘要:Problem Statement Takahashi will take part in an eating contest. Teams of NN members will compete in this contest, and Takahashi's team consists of NN 阅读全文
posted @ 2020-03-22 00:53 脂环 阅读(384) 评论(0) 推荐(0) 编辑
摘要:问题描述 数轴上有n个闭区间D1,…,Dn。其中区间Di用一对整数[ai, bi]来描述,满足ai < bi。已知这些区间的长度之和至少有10000。所以,通过适当的移动这些区间,你总可以使得他们的“并”覆盖[0, 10000]——也就是说[0, 10000]这个区间内的每一个点都落于至少一个区间内 阅读全文
posted @ 2020-03-06 23:10 脂环 阅读(714) 评论(0) 推荐(0) 编辑
摘要:The map of Bertown can be represented as a set of nn intersections, numbered from 11 to nn and connected by mm one-way roads. It is possible to move a 阅读全文
posted @ 2020-03-03 23:15 脂环 阅读(127) 评论(0) 推荐(0) 编辑
摘要:You are given a string ss consisting of lowercase Latin letters. Let the length of ss be |s||s| . You may perform several operations on this string. I 阅读全文
posted @ 2020-03-03 00:59 脂环 阅读(202) 评论(0) 推荐(0) 编辑
摘要:You are given a sequence b1,b2,…,bnb1,b2,…,bn . Find the lexicographically minimal permutation a1,a2,…,a2na1,a2,…,a2n such that bi=min(a2i−1,a2i)bi=mi 阅读全文
posted @ 2020-02-26 00:41 脂环 阅读(309) 评论(0) 推荐(0) 编辑
摘要:问题描述 小明正在玩一个“翻硬币”的游戏。 桌上放着排成一排的若干硬币。我们用 * 表示正面,用 o 表示反面(是小写字母,不是零)。 比如,可能情形是:**oo***oooo 如果同时翻转左边的两个硬币,则变为:oooo***oooo 现在小明的问题是:如果已知了初始状态和要达到的目标状态,每次只 阅读全文
posted @ 2020-02-24 19:22 脂环 阅读(183) 评论(0) 推荐(0) 编辑
摘要:This is an easier version of the problem. In this version n≤1000n≤1000 The outskirts of the capital are being actively built up in Berland. The compan 阅读全文
posted @ 2020-02-24 15:08 脂环 阅读(431) 评论(0) 推荐(0) 编辑
摘要:Tired of boring office work, Denis decided to open a fast food restaurant. On the first day he made aa portions of dumplings, bb portions of cranberry 阅读全文
posted @ 2020-02-24 14:30 脂环 阅读(364) 评论(0) 推荐(0) 编辑
摘要:Anu has created her own function ff : f(x,y)=(x|y)−y where || denotes the bitwise OR operation. For example, f(11,6)=(11|6)−6=15−6=9. It can be proved 阅读全文
posted @ 2020-02-10 13:20 脂环 阅读(158) 评论(0) 推荐(0) 编辑
摘要:There are nn monsters standing in a row numbered from 11 to nn . The ii -th monster has hihi health points (hp). You have your attack power equal to a 阅读全文
posted @ 2020-02-06 15:26 脂环 阅读(305) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩