![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 59
wxl7777
这个作者很懒,什么都没留下…
展开
-
二分与快排结合
#1128 : 二分·二分查找时间限制:10000ms单点时限:1000ms内存限制:256MB描述Nettle最近在玩《艦これ》,因此Nettle收集了很多很多的船(这里我们假设Nettle氪了很多金,开了无数个船位)。去除掉重复的船之后,还剩下N(1≤N≤1,000,000)种不同的船。每一艘船有一个稀有值,任意两艘船的稀有值都不相同原创 2017-11-07 19:33:29 · 470 阅读 · 0 评论 -
Codeforces Round #209 B. Permutation
A permutation p is an ordered group of numbers p1, p2, ..., pn, consisting of n distinct positive integers, each is no more than n. We'll define number n as the length of permutation p1, p2, ...原创 2019-01-19 22:49:36 · 164 阅读 · 0 评论 -
Codeforces Global Round 1 D. Jongmah
You are playing a game of Jongmah. You don't need to know the rules to solve this problem. You have nntiles in your hand. Each tile has an integer between 11 and mm written on it.To win the game, yo...原创 2019-02-10 20:52:28 · 450 阅读 · 0 评论 -
[Offer收割]编程练习赛95
题目1 : 浇花问题描述小Hi在一条小路上种植了一排月季,总共有N株。这条小路的一端是一个水龙头。N株月季距离水龙头由近到远的距离依次是A1, A2, ... AN,每天需要浇水的量依次是B1, B2, ... BN。 现在小Hi有一个容量是C的水壶。他从水龙头出发,拎着灌满的水壶,依次去浇灌第1株、第2株、第3株…… 如果浇完第K株时,小Hi发现水壶中剩余的水量不足以浇灌第K+1株...原创 2019-03-16 14:11:01 · 293 阅读 · 0 评论 -
E. Median String
You are given two stringsssandtt, both consisting of exactlykklowercase Latin letters,ssis lexicographically less thantt.Let's consider list of all strings consisting of exactlykklowercase...原创 2019-04-07 18:17:55 · 395 阅读 · 4 评论 -
D. Bubble Sort Graph
Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation withnelementsa1,a2, ...,anin ascending order. He is bored of this so simple algorithm, so he invents his o...原创 2019-05-31 22:05:44 · 276 阅读 · 0 评论 -
B. Working out
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrixawithnlines andmcolumns. Let numbera[i][j]represent...原创 2019-06-12 21:01:37 · 278 阅读 · 1 评论 -
D. Ehab and the Expected XOR Problem
outputstandard outputGiven two integersnnandxx, construct an array that satisfies the following conditions:for any elementaiaiin the array,1≤ai<2n1≤ai<2n; there is nonon-emptysubs...原创 2019-06-06 22:47:00 · 256 阅读 · 0 评论 -
D. Mysterious Present
Peter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make achain. Chain here is such a sequence of envelopesA = {...原创 2019-06-13 17:12:58 · 560 阅读 · 0 评论 -
C. Bear and Prime Numbers
Recently, the bear started studying data structures and faced the following problem.You are given a sequence of integersx1, x2, ..., xnof lengthnandmqueries, each of them is characterized by t...原创 2019-06-13 21:14:18 · 314 阅读 · 0 评论 -
C. Vanya and Scales
Vanya has a scales for weighing loads and weights of massesw0, w1, w2, ..., w100grams wherewis some integer not less than2(exactly one weight of each nominal value). Vanya wonders whether he can ...原创 2019-06-09 21:50:15 · 268 阅读 · 0 评论 -
A. Primes or Palindromes?
题目链接:http://codeforces.com/problemset/problem/568/ARikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number...原创 2019-06-15 22:01:55 · 194 阅读 · 0 评论 -
B. Bear and Blocks
One day, little Vasya found himself in a maze consisting of(n + 1)rooms, numbered from1to(n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the(n + 1)-...原创 2019-06-10 22:30:43 · 146 阅读 · 0 评论 -
C. Barcode
You've got ann × mpixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture.A picture is a barcode if the followin...原创 2019-06-11 11:35:32 · 406 阅读 · 0 评论 -
E. Lunar New Year and Red Envelopes
题目链接:http://codeforces.com/problemset/problem/1106/ELunar New Year is approaching, and Bob is going to receive some red envelopes with countless money!But collecting money from red envelopes is a t...原创 2019-06-21 16:06:11 · 451 阅读 · 0 评论 -
B. Nauuo and Circle
题目链接:http://codeforces.com/problemset/problem/1172/BNauuo is a girl who loves drawing circles.One day she has drawn a circle and wanted to draw a tree on it.The tree is a connected undirected gr...原创 2019-06-17 21:57:04 · 429 阅读 · 0 评论 -
E. XOR and Favorite Number
Bob has a favorite numberkandaiof lengthn. Now he asks you to answermqueries. Each query is given by a pairliandriand asks you to count the number of pairs of integersiandj, such thatl ...原创 2019-06-25 21:52:56 · 341 阅读 · 0 评论 -
comt oj Comet OJ - Contest #5
迫真小游戏题目链接:https://cometoj.com/contest/46/problem/C?problem_id=2028题目描述H君喜欢在阳台晒太阳,闲暇之余他会玩一些塔防小游戏。H君玩的小游戏可以抽象成一棵nn个节点的有根树,树以11为根,每个点的深度定义为其到根的简单路径上的点数(根的深度为11)。H君有nn个干员,H君会按照某种顺序把她们部...原创 2019-06-23 12:57:52 · 357 阅读 · 0 评论 -
Codeforces Round #116 (Div. 2, C. Letter
Patrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervous while writing the message, so some of the letters there wer...原创 2019-01-19 22:35:30 · 238 阅读 · 0 评论 -
Educational Codeforces Round 19 B. Odd sum
You are given sequence a1, a2, ..., an of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given seq...原创 2019-01-18 22:50:02 · 137 阅读 · 0 评论 -
offer收割编程赛34(股票价格3)
时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi最近在关注股票,为了计算股票可能的盈利,他获取了一只股票最近N天的价格A1~AN。 小Hi想知道,对于第i天的股票价格Ai,几天之后股价会第一次超过Ai。 假设A=[69, 73, 68, 81, 82],则对于A1=69,1天之后的股票价格就超过了A1;对于A2=73,则是2天之后股票价格才超...原创 2017-11-05 20:34:03 · 358 阅读 · 1 评论 -
杭电2036计算多边面积
“ 改革春风吹满地,不会AC没关系;实在不行回老家,还有一亩三分地。谢谢!(乐队奏乐)”话说部分学生心态极好,每天就知道游戏,这次考试如此简单的题目,也是云里雾里,而且,还竟然来这么几句打油诗。好呀,老师的责任就是帮你解决问题,既然想种田,那就分你一块。这块田位于浙江省温州市苍南县灵溪镇林家铺子村,多边形形状的一块地,原本是linle 的,现在就准备送给你了。不过,原创 2017-11-01 16:02:24 · 224 阅读 · 0 评论 -
杭电2036叉乘法求多边行面积
z“ 改革春风吹满地,不会AC没关系;实在不行回老家,还有一亩三分地。谢谢!(乐队奏乐)”话说部分学生心态极好,每天就知道游戏,这次考试如此简单的题目,也是云里雾里,而且,还竟然来这么几句打油诗。好呀,老师的责任就是帮你解决问题,既然想种田,那就分你一块。这块田位于浙江省温州市苍南县灵溪镇林家铺子村,多边形形状的一块地,原本是linle 的,现在就准备送给你了。不过原创 2017-10-31 22:29:54 · 239 阅读 · 0 评论 -
二分法与快排结合(2)
#1133 : 二分·二分查找之k小数时间限制:10000ms单点时限:1000ms内存限制:256MB描述在上一回里我们知道Nettle在玩《艦これ》,Nettle的镇守府有很多船位,但船位再多也是有限的。Nettle通过捞船又出了一艘稀有的船,但是已有的N(1≤N≤1,000,000)个船位都已经有船了。所以Nettle不得不把其中一原创 2017-11-07 19:45:30 · 319 阅读 · 0 评论 -
C. Liebig's Barrels
outputstandard outputYou have m = n·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, you can use any k staves to construct a barrel. Each stav...原创 2018-05-23 15:14:45 · 474 阅读 · 0 评论 -
中南林业科技大学第十一届程序设计大赛 I-背包问题
链接:https://www.nowcoder.com/acm/contest/124/I来源:牛客网01背包是是一个普通的动态规划入门问题: 一共有n个物品, 第i个物品的体积为v[i]; 有一个背包容量为m,现在我要挑选一些物品放入这个背包 我现在知道在总体积不超过背包容量的情况下,他一共有多少种放法(总体积为0也算一种放法)。 1 <= n <= 30, ...原创 2018-05-30 16:32:38 · 216 阅读 · 0 评论 -
中南林业科技大学第十一届程序设计大赛 H 渴望力量吗
链接:https://www.nowcoder.com/acm/contest/124/H来源:牛客网为了不断优化推荐效果,内涵段子(段友出征,寸草不生)每天要存储和处理海量数据。 假设有这样一种场景:我们对用户按照它们的注册时间先后来标号,对于一类文章,每个用户都有不同的喜好值,我们会想知道某一段时间内注册的用户(标号相连的一批用户)中,有多少用户对这类文章喜好值为k。 因为一些特殊...原创 2018-05-30 16:42:46 · 207 阅读 · 0 评论 -
编程练习赛80 卡片序列
时间限制:10000ms单点时限:1000ms内存限制:256MB描述一张卡片可以被表示成这种形式 [color1 | value | color2],也可以通过翻转操作变成[color2 | value | color1]。两张卡片能够连接,当且仅当左边卡片右边的颜色和右边卡片左边的颜色相同。现在你有n张这样的卡片,你可以通过翻转和连接操作将其中一部分卡片串成一串,现在你需要...原创 2018-10-25 21:01:24 · 295 阅读 · 0 评论 -
基础最短路 HDU2544
在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛...原创 2018-11-18 18:39:25 · 132 阅读 · 0 评论 -
最短路(注意建图) HDU - 2066
虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的放个假...原创 2018-11-18 18:43:56 · 129 阅读 · 0 评论 -
Wannafly挑战赛29 A
链接:https://ac.nowcoder.com/acm/contest/271/A来源:牛客网 题目描述misaka是呱太爷爷的小粉丝,呱太爷爷有一句话说的好:"一尺之棰,日取其半,万世不竭"。misaka现在有 n 个呱太玩偶放在一堆,每一次操作,misaka会选择当前个数 > 1 的一堆呱太玩偶。并将这一堆呱太玩偶分成 和 两堆,x 是当前这一堆玩偶的个数。现在 m...原创 2018-11-25 18:29:14 · 217 阅读 · 0 评论 -
Codeforces Round #523 (Div. 2) C. Multiplicity
outputstandard outputYou are given an integer array a1,a2,…,ana1,a2,…,an.The array bb is called to be a subsequence of aa if it is possible to remove some elements from aa to get bb.Array b1,b...原创 2018-11-25 18:53:45 · 257 阅读 · 0 评论 -
Codeforces Round #523 (Div. 2) D. TV Shows
outputstandard outputThere are nn TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The ii-th of the shows is going from lili-th to riri-th minute, bot...原创 2018-11-25 19:06:32 · 256 阅读 · 0 评论 -
[Offer收割]编程练习赛88
题目2 : 增加得分描述小Hi在玩一款游戏,游戏中有N名玩家,每名玩家都有一个自己的当前分数A1, A2, ... AN。其中A1是小Hi的分数。 现在小Hi有2种方式提升自己的得分1. 将自己的得分A1直接增加1分。该方式会消耗X枚金币2. 从A2~AN中选则一名对手Ai,将自己的得分A1直接增加1分,对手Ai的得分减少1分。该方式会消耗Y枚金币。小Hi的目标是成为N名...原创 2018-12-26 19:03:17 · 194 阅读 · 0 评论 -
[Offer收割]编程练习赛88
题目3 : 字符替换描述给定一个只包含小写字母的初始字符串S,以及N个操作。每个操作都是把当前字符串中所有的字符Xi替换成字符Yi (Xi, Yi是一个小写字母),上一个操作的结果是下一个操作的对象。现在小Hi要对初始字符串完成所有N个操作,不过他可以任意安排N个操作的顺序。他希望最终得到的字符串中有最多的'h'字符。请你算出最多能得到多少个'h'字符。输入第一行包含一个整数N...原创 2018-12-26 19:16:52 · 193 阅读 · 0 评论 -
西北大学第四届程序设计竞赛新生赛(同步赛)(J)
链接:https://ac.nowcoder.com/acm/contest/321/J来源:牛客网 众所周知,八意永琳擅长制作药物.今天八意永琳又制作了很多份药物,但是由于材料组成的不同,最终的品级也会不同已知八意永琳制作的药物中,一共有n种不同的主材料,用1...n编号,每种主材料有ai种产地,每种产地都有自己的品级.每种主材料只取某个产地的一份,最终该药物的品级为所有主材料的...原创 2018-12-24 20:20:15 · 247 阅读 · 0 评论 -
B. Approximating a Constant Range
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be ...原创 2019-01-17 21:27:09 · 249 阅读 · 0 评论 -
D. Berland Fair
题目链接:http://codeforces.com/contest/1073/problem/DXXI Berland Annual Fair is coming really soon! Traditionally fair consists ofnnbooths, arranged in a circle. The booths are numbered11throughnnc...原创 2019-06-23 13:11:54 · 250 阅读 · 0 评论