自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(44)
  • 收藏
  • 关注

原创 Gluttony(codeforce-891B)

D. Gluttonytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a with n distinct inte

2017-11-18 13:32:24 721

原创 White, Black and White Again )(CodeForces - 306C)

White, Black and White AgainPolycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus know

2017-11-08 19:49:54 387

原创 uva-1198

Let G = (V,E) be a connected graph without loops and multiple edges, where V and E are the vertex and edge, respectively, sets of G. For any two vertices u, v ∈ V ,the distance between vertices u and v in G is the number of edges in a shortest u-v path. A

2017-09-13 21:02:35 364

原创 HDU - 1711(Number Sequence )(KMP)

Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], ...... , a[K + M - 1] = b[M]. If th

2017-09-13 20:54:55 310

原创 hdu 4734 【数位DP】

Problem DescriptionFor a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1. Now you are given two numbers A and B, please calculate how many numbers are there between 0 and

2017-09-13 20:41:53 340

原创 选择子序列(51nod-1153)

长度为N的整数数组A,所有的数均不相同,假设下标从0开始。找到一个最长的数组B,B数组的长度为K,数值范围是0 - N - 1,记录的是A数组的下标。满足A[B[0]] > A[B[1]] > A[B[2]] >...A[B[K]],并且对任意连续的两项B[i]及B[i + 1],满足min(B[i],B[i + 1]) < j < max(B[i],B[i + 1]) 均有A[j] < A[B[i + 1]] ,求最大的K。例如:9, 10, 2, -1, 3, -5, 0, -3, 1, 12, 5,

2017-09-07 16:02:27 410

原创 Planning(贪心)

Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metro

2017-09-07 13:34:38 660

原创 Prime Number(CodeForces - 359C )

Simon has a prime number x and an array of non-negative integers a1, a2, ..., an.Simon loves fractions very much. Today he wrote out number on a piece of paper. After Simon led all fractions to a common denominator and summed them up, he got a fraction:

2017-08-30 15:41:12 404

原创 食物链(poj-1182)(带权并查集)

动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。 1) 当前的话与

2017-08-26 21:29:15 308

原创 Zjnu Stadium(hdu-3047)(带权并查集)

In 12th Zhejiang College Students Games 2007, there was a new stadium built in Zhejiang Normal University. It was a modern stadium which could hold thousands of people. The audience Seats made a circle. The total number of columns were 300 numbered 1--300,

2017-08-26 21:25:36 363

原创 子序列个数(51nod-1202)(dp)

子序列的定义:对于一个序列a=a[1],a[2],......a[n]。则非空序列a'=a[p1],a[p2]......a[pm]为a的一个子序列,其中1<=p1<p2<.....<pm<=n。例如4,14,2,3和14,1,2,3都为4,13,14,1,2,3的子序列。对于给出序列a,有些子序列可能是相同的,这里只算做1个,请输出a的不同子序列的数量。由于答案比较大,输出Mod 10^9 + 7的结果即可。

2017-08-20 19:33:18 252

原创 Brackets(poj-2955)(区间dp)

BracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8762 Accepted: 4690DescriptionWe give the following inductive definition of a “regular bracket

2017-08-16 17:22:28 257

原创 NYOJ 石子合并(一)经典区间DP

石子合并(一)时间限制:1000 ms  |  内存限制:65535 KB难度:3描述    有N堆石子排成一排,每堆石子有一定的数量。现要将N堆石子并成为一堆。合并的过程只能每次将相邻的两堆石子堆成一堆,每次合并花费的代价为这两堆石子的和,经过N-1次合并后成为一堆。求出总的代价最小值。输入有多组测试数据,输入到文件结束。每组测试数据第一行有一个整

2017-08-16 16:00:28 275

原创 A序列(最长上升子序列)

如果一个序列有奇数个正整数组成,不妨令此序列为a1,a2,a3,...,a2∗k+1(0<=k),并且a1,a2...ak+1是一个严格递增的序列,ak+1,ak+2,...,a2∗k+1,是一个严格递减的序列,则称此序列是A序列。比如1 2 5 4 3就是一个A序列。现在Jazz有一个长度为n的数组,他希望让你求出这个数组所有满足A序列定义的子序列里面最大的那个长度。(子序列可以不连续)比如1 2 5 4 3 6 7 8 9,最长的A序列子串是1 2 5 4 3。

2017-08-15 15:20:54 464

原创 最少拦截系统(hdu-1257)(最长上升子序列)

某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统.

2017-08-15 15:16:43 271

原创 Cash Machine(poj-1276)(多重背包)

A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k=1,N, and for each denomination Dk the machine has a sup

2017-08-15 15:15:08 332

原创 Piggy-Bank(hdu-1114)(完全背包)

Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple. Whenever some ACM member has any small money, he takes

2017-08-15 15:12:37 295

原创 饭卡(hdu-2546)(01背包)

饭卡电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。

2017-08-15 15:08:13 249

原创 Matrix (POJ - 2155 )(树状数组的区间更新-点查询)

Matrix (POJ - 2155 )Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N). We can change the matrix in the following way. Given a rectangle whose

2017-08-09 21:21:10 223

原创 Can you answer these queries? (HDU - 4027)(线段树区间更新-区间查询)

Can you answer these queries? (HDU - 4027)A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of endurance. For ev

2017-08-09 20:45:22 411

原创 Just a Hook (HDU - 1698)(线段树的区间更新-区间查询)

Just a Hook (HDU - 1698)In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.

2017-08-09 20:41:59 320

原创 I Hate It (HDU - 1754) (线段树的点更新-最值查询)

I Hate It (HDU - 1754) 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。

2017-08-09 20:38:48 260

原创 敌兵布阵(HDU - 1166)(线段树的点更新-区间查询)

敌兵布阵(HDU - 1166)C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。

2017-08-09 20:33:08 385

原创 树状数组的修改与查询总结

树状数组的修改与查询总结树状数组的单点修改区间查询树状数组的区间修改单点查询树状数组的区间修改区间查询

2017-08-09 14:25:35 809

原创 Jzzhu and Cities(CodeForces - 449B)

Jzzhu and Cities(CodeForces - 449B) Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using

2017-08-06 19:00:57 428

原创 spfa的SLF 和 LLL优化算法

spfa的 SLF 和 LLL优化算法spfa判负环,spfa的双向队列优化

2017-08-06 11:52:36 2129

原创 Count The Pairs(hdu-4750)(最小生成树)

Count The Pairs(hdu-4750) With the 60th anniversary celebration of Nanjing University of Science and Technology coming soon, the university sets n tourist spots to welcome guests. Of course, Redwood forests in our university and its Orychophragmus violac

2017-08-05 19:09:18 383

原创 The Festive Evening(思维题)

The Festive EveningIt's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed to

2017-07-31 15:25:54 353

原创 The Meaningless Game(思维题)

The Meaningless GameSlastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or

2017-07-31 12:33:56 1043

原创 Find The Multiple(poj 1426)

Find The Multiple(poj 1426)Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m contai

2017-07-29 15:11:22 1912 2

原创 非常可乐(HDU-1495)

非常可乐大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,

2017-07-28 20:17:53 1381 1

原创 Garland(CodeForces - 767C )

Garland(CodeForces - 767C )Once at New Year Dima had a dream in which he was presented a fairy garland. A garland is a set of lamps, some pairs of which are connected by wires. Dima remembered that each two lamps in the garland were connected directly or

2017-07-28 19:50:52 617

原创 Fire!( UVA - 11624)

Fire!( UVA - 11624) Joe works in a maze. Unfortunately, portions of the maze havecaught on fire, and the owner of the maze neglected to create a fireescape plan. Help Joe escape the maze.Given Joe’s location in the maze and wh

2017-07-28 19:38:13 372

原创 The Tag Game(CodeForces - 813C)

The Tag Game(CodeForces - 813C)Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices. Vertex 1 is the root of the tree.

2017-07-28 12:37:50 801 1

原创 Alternative Thinking(CodeForces - 604C)(思维)

Alternative Thinking(CodeForces - 604C)Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the

2017-07-25 18:58:24 355

原创 Maze(CodeForces - 377A )(思维,广搜)

Maze(CodeForces - 377A )Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.

2017-07-25 14:47:44 501 3

原创 Largest Rectangle in a Histogram(POJ-2559)

Largest Rectangle in a Histogram(POJ-2559)DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows t

2017-07-25 14:36:31 300

原创 Petya and Exam(Codeforces Round #425 (Div. 2))

Petya and ExamIt's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one..There is a glob pattern in the statements (a stri

2017-07-25 00:34:40 398 1

原创 宝岛地图 (51Nod-1572)

宝岛地图(51Nod-1572)勇敢的水手们到达了一个小岛,在这个小岛上,曾经有海盗在这里埋下了一些宝藏。然而,我们的船快抛锚了,与此同时,船长发现藏宝图的一角被老鼠咬掉了一块。 藏宝图可以用一个n×m大小的矩形表示。矩形中的每一小块表示小岛中的一小块陆地(方块的边长为1米)。有一些方块表示的是海,这些块人是不能通过的。除了海不能走,其它的小方块都是可以行走的。在可行走区域里有一些小方块表示一些已知的地点。

2017-07-22 11:17:45 1310 2

原创 Battle City(POJ - 2312)(深搜+优先队列)

Battle City(POJ - 2312)Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers,

2017-07-22 10:56:30 571

空空如也

空空如也

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

TA关注的人

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