自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Low Coder的博客

你必须非常努力,才能看起来毫不费力。但问耕耘,莫问收获。

  • 博客(119)
  • 收藏
  • 关注

原创 EOJ3640. 素数子序列

3640. 素数子序列DESCRIPTIONSTATISTICSDISCUSSIONTime limit per test: 1.0 secondsMemory limit: 512 megabytes有一个长度为 n 的序列 a1,a2,…,an,某些位置已经固定 (ai>0),其他位置允许乱填 (ai=0)。现求一种填法,使得填完之后,序列的任意连续子序列的和都是质数...

2018-09-15 21:50:41 356

原创 Hackerrank Subsequence Weighting(单调set 数状数组)

A subsequence of a sequence is a sequence which is obtained by deleting zero or more elements from the sequence. You are given a sequence A in which every element is a pair of integers  i.e  A = [(a...

2018-09-14 15:13:06 439

原创 洛谷 P1880 [NOI1995]石子合并

题目描述在一个圆形操场的四周摆放N堆石子,现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得分。试设计出1个算法,计算出将N堆石子合并成1堆的最小得分和最大得分.输入输出格式输入格式: 数据的第1行试正整数N,1≤N≤100,表示有N堆石子.第2行有N个数,分别表示每堆石子的个数. 输出格式: 输出共...

2018-09-13 20:53:19 195

转载 一种特殊的判断素数的方法

http://blog.csdn.net/huang_miao_xin/article/details/51331710(转载地址)首先看一个关于质数分布的规律:大于等于5的质数一定和6的倍数相邻。例如5和7,11和13,17和19等等;证明:令x≥1,将大于等于5的自然数表示如下:······ 6x-1,6x,6x+1,6x+2,6x+3,6x+4,6x+5,6(x+1),6(x+1...

2018-09-13 18:49:04 428

原创 洛谷 P1020 导弹拦截

题目描述某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。输入导弹依次飞来的高度(雷达给出的高度数据是\le 50000≤50000的正整数),计算这套系统最多能拦截多少导弹...

2018-09-13 00:54:32 237

原创 POJ1251 Jungle Roads(最小生成树)

Jungle RoadsTime Limit: 1000MS   Memory Limit: 10000K Total Submissions: 32191   Accepted: 15056 DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A b...

2018-09-11 21:46:48 135

原创 洛谷P1118 [USACO06FEB]数字三角形 Backward Digit Su(dfs剪枝)

题目描述FJ and his cows enjoy playing a mental game. They write down the numbers from 11 toN(1 \le N \le 10)N(1≤N≤10) in a certain order and then sum adjacent numbers to produce a new list with one fewe...

2018-09-11 20:27:11 221

原创 洛谷P1434 [SHOI2002]滑雪

题目描述Michael喜欢滑雪。这并不奇怪,因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道在一个区域中最长的滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子:1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 ...

2018-09-11 12:04:09 190

原创 洛谷P1182 数列分段`Section II`

题目描述对于给定的一个长度为N的正整数数列A-iA−i,现要将其分成M(M≤N)M(M≤N)段,并要求每段连续,且每段和的最大值最小。关于最大值最小:例如一数列4 2 4 5 142451要分成33段将其如下分段:[4 2][4 5][1][42][45][1]第一段和为66,第22段和为99,第33段和为11,和最大值为99。将其如下分段:[4][2 4][5 1...

2018-09-11 00:17:40 847

原创 洛谷P1316 丢瓶盖(二分)

题目描述陶陶是个贪玩的孩子,他在地上丢了A个瓶盖,为了简化问题,我们可以当作这A个瓶盖丢在一条直线上,现在他想从这些瓶盖里找出B个,使得距离最近的2个距离最大,他想知道,最大可以到多少呢?输入输出格式输入格式: 第一行,两个整数,A,B。(B<=A<=100000)第二行,A个整数,分别为这A个瓶盖坐标。 输出格式: 仅一个整数,为所求答案。...

2018-09-10 19:49:49 258

原创 PAT1033 To Fill or Not to Fill(贪心)

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 tank capacity of a car is limited, we have to find gas stations on the ...

2018-09-10 18:51:59 113

原创 Codeforces Round #506 (Div. 3) A. Many Equal Substrings

A. Many Equal SubstringsYou are given a string tt consisting of nn lowercase Latin letters and an integer number kk.Let's define a substring of some string ss with indices from ll to rr as s[l…r]s...

2018-09-09 23:30:04 352

原创 Problem J. Jim and the Skyscrapers(线段树)

Problem J. Jim and the Skyscraper题意:给定一个序列, 要你找出区间满足:区间首尾元素相等且中间元素均小于首尾元素。要求你找出这样的区间个数解法:线段树首先存储每个数字所有的出现位置,然后从最小的数开始遍历(遍历数字)对于某个数字 如果出现的次数大于等于2然后我们要做的事情是 将所有的位置进行划分:如果所有的位置之间任意两个数都可以,则答...

2018-09-08 00:45:20 106

原创 PAT 1021 Deepest Root

1021 Deepest Root(25 分)A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in a hi...

2018-09-05 01:28:41 90

原创 PAT1107 Social Clusters(并查集)

1107 Social Clusters(30 分)When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of ...

2018-09-03 16:42:45 295

原创 PAT1003 Emergency (最短路)

1003 Emergency(25 分)As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams ...

2018-09-03 15:39:29 163

原创 洛谷 P1064 金明的预算方案

题目描述金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过NN元钱就行”。今天一早,金明就开始做预算了,他把想买的物品分为两类:主件与附件,附件是从属于某个主件的,下表就是一些主件与附件的例子:主件 附件电脑 打印机,扫描仪书柜 图书书桌 台灯,文具工...

2018-09-02 23:47:34 205

原创 洛谷 P1057 传球游戏

题目描述上体育课的时候,小蛮的老师经常带着同学们一起做游戏。这次,老师带着同学们一起做传球游戏。游戏规则是这样的:nn个同学站成一个圆圈,其中的一个同学手里拿着一个球,当老师吹哨子时开始传球,每个同学可以把球传给自己左右的两个同学中的一个(左右任意),当老师再次吹哨子时,传球停止,此时,拿着球没有传出去的那个同学就是败者,要给大家表演一个节目。聪明的小蛮提出一个有趣的问题:有多少种不同...

2018-08-30 21:25:34 190

原创 洛谷 P1025 数的划分

题目描述将整数nn分成kk份,且每份不能为空,任意两个方案不相同(不考虑顺序)。例如:n=7n=7,k=3k=3,下面三种分法被认为是相同的。1,1,51,1,5;1,5,11,5,1;5,1,15,1,1.问有多少种不同的分法。输入输出格式输入格式: n,kn,k (6<n \le 2006<n≤200,2 \le k \le 62≤k≤6) ...

2018-08-28 12:39:18 441

原创 洛谷 P1017 进制转换

题目描述我们可以用这样的方式来表示一个十进制数: 将每个阿拉伯数字乘以一个以该数字所处位置的(值减 11 )为指数,以 1010为底数的幂之和的形式。例如: 123123 可表示为 1 \times 10^2+2\times 10^1+3\times 10^01×102+2×101+3×100 这样的形式。与之相似的,对二进制数来说,也可表示成每个二进制数码乘以一个以该数字所处位置的(值 ...

2018-08-24 18:39:36 1036

原创 洛谷 P1498 南蛮图腾

题目描述自从到了南蛮之地,孔明不仅把孟获收拾的服服帖帖,而且还发现了不少少数民族的智慧,他发现少数民族的图腾往往有着一种分形的效果,在得到了酋长的传授后,孔明掌握了不少绘图技术,但唯独不会画他们的图腾,于是他找上了你的爷爷的爷爷的爷爷的爷爷……帮忙,作为一个好孙子的孙子的孙子的孙子……你能做到吗?输入输出格式输入格式: 每个数据一个数字,表示图腾的大小(此大小非彼大小) n&l...

2018-08-24 13:22:25 812

原创 洛谷 P1010 幂次方

题目描述任何一个正整数都可以用 22 的幂次方表示。例如137=2^7+2^3+2^0137=27+23+20同时约定方次用括号来表示,即 a^bab 可表示为 a(b)a(b) 。由此可知, 137137 可表示为:2(7)+2(3)+2(0)2(7)+2(3)+2(0)进一步:7= 2^2+2+2^07=22+2+20(2^1用2表示),并且3=2+2^03=2...

2018-08-24 11:59:56 169

原创 洛谷P1908 逆序对

题目描述猫猫TOM和小老鼠JERRY最近又较量上了,但是毕竟都是成年人,他们已经不喜欢再玩那种你追我赶的游戏,现在他们喜欢玩统计。最近,TOM老猫查阅到一个人类称之为“逆序对”的东西,这东西是这样定义的:对于给定的一段正整数序列,逆序对就是序列中ai>aj且i<j的有序对。知道这概念后,他们就比赛谁先算出给定的一段正整数序列中逆序对的数目。输入输出格式输入格式: 第...

2018-08-24 10:39:41 367

原创 HDU1711 Number Sequence(KMP)

Number SequenceTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 40595    Accepted Submission(s): 16759Problem DescriptionGiven two sequence...

2018-08-23 19:29:10 114

原创 Codeforces Gym 100796E Permutation Polygon [树状数组]

E. Permutation PolygonThere are n cities in Regularia, Alice's homeland. They are located at the vertices of a regular n-gon. The cities are numbered from 1 to nin a clockwise order (see the figure)...

2018-08-23 17:38:11 412

原创 Codeforces743D Chloe and pleasant prizes(树形dp)

D. Chloe and pleasant prizesGenerous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponso...

2018-08-23 15:59:34 312 2

原创 洛谷P1115 最大子段和

题目描述给出一段序列,选出其中连续且非空的一段使得这段和最大。输入输出格式输入格式: 第一行是一个正整数 NN ,表示了序列的长度。第二行包含 NN 个绝对值不大于 1000010000 的整数 A_iAi​ ,描述了这段序列。 输出格式: 一个整数,为最大的子段和是多少。子段的最小长度为 11 。 输入输出样例输入样例#1: 72 -4...

2018-08-14 16:55:01 235

原创 Codeforces697C Lorenzo Von Matterhorn

Lorenzo Von MatterhornBarney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i ...

2018-08-14 13:11:46 229

原创 Codeforces126B Password

PasswordAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little ...

2018-08-10 17:08:59 240

原创 Codeforces848B Rooter's Song

Rooter's Song Wherever the destination is, whoever we meet, let's render this song together.On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with ...

2018-08-07 17:05:19 186

原创 Codeforces 675D Tree Construction

D. Tree ConstructionDuring the programming classes Vasya was assigned a difficult problem. However, he doesn't know how to code and was unable to find the solution in the Internet, so he asks you to...

2018-08-05 22:45:58 357

原创 洛谷p1028 数的计算

题目描述我们要求找出具有下列性质数的个数(包含输入的自然数 nn ):先输入一个自然数 nn ( n \le 1000n≤1000 ),然后对此自然数按照如下方法进行处理: 不作任何处理; 在它的左边加上一个自然数,但该自然数不能超过原数的一半; 加上数后,继续按此规则进行处理,直到不能再加自然数为止. 输入输出格式输入格式:11 个自然数 nn ( ...

2018-08-04 23:03:15 1457

原创 Codeforces Round #158 (Div. 2) D. Black and White Tree

D. Black and White TreeThe board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles....

2018-07-24 16:14:43 168

原创 Codeforces Round #160 (Div. 1) B. Maxim and Restaurant

B. Maxim and RestaurantMaxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.Maxim has got a dinner party tonight, n guests will come to him. Let...

2018-07-24 15:22:03 161

原创 Codeforces Round #160 (Div. 1) A. Maxim and Discounts

A. Maxim and Discounts Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.There are m types of discounts. We assume that the discounts...

2018-07-24 09:58:14 186

原创 Codeforces Round #210 (Div. 1) A. Levko and Array Recovery

A. Levko and Array RecoveryLevko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operatio...

2018-07-23 09:40:03 136

原创 Codeforces Round #158 (Div. 2)C. Balls and Boxes

C. Balls and Boxestime limit per test:1 second memory limit per test:256 megabytesLittle Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to...

2018-07-23 00:14:49 159

原创 Day 01: Random Mashup

2018.7.19今天是训练的第一场比赛今日ranklist:A. Levko and Table题意:给定n和k,要求你构造出一个n维方阵使得每行每列的和等于k解法:对角线是k 其他数是0即可B. Levko and Permutation题意:给定n和k,要求你构造出一个序列有n个数(1~n),使得每个数与其下标的最大公约数大于等于1的个数为k个解法:只需要...

2018-07-22 16:46:15 143

原创 Codeforces1006E Military Problem

E. Military Problemtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you will have to help Berland army with organ...

2018-07-17 15:26:19 392

原创 Codeforces 1005DPolycarp and Div 3

D. Polycarp and Div 3time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp likes numbers that are divisible by 3.He has a huge number ss. Polyc...

2018-07-11 00:20:15 355

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除