自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

新月

红色春天的开始

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

原创 LA3902 Network (树上dfs)

题目链接:点击打开链接题意:n台机器连成一个树状网络,其中叶节点是客户端,其他节点是服务器,目前有一台服务器s正在提供服务。让你在其他服务器上也安排同样的服务,使得每台客户端到最近服务器的距离不超过k,而且要使服务器尽量少,问最少要设置多少台服务器。思路:我们先把s看做根节点,做一遍dfs,把离s距离小于等于k的叶子节点标为访问过,表示这个叶子节点已经得到服务了,然后再把没有访问过的叶子节

2016-03-30 12:42:55 677

原创 zoj3494 BCD Code(AC自动机+数位dp)

Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence. To encode a decimal number using the common BCD encoding, each decimal di

2016-03-29 21:57:23 498

原创 codeforces #345 (Div. 1) D. Zip-line (线段树+最长上升子序列)

Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long as possible but he doesn't remember exactly the heights of all trees in the forest. He is sure that h

2016-03-29 14:05:25 927

原创 zjnu1786 PROSJEK(二分)

DescriptionSample Input4 11 2 3 4Sample Output4.000000题意:给你n个数,让你找到长度大于等于k的连续串的最大平均值。思路:我们可以二分答案,然后先把每一个数减去二分的平均值,记录前缀和sum[i],用从k开始循环,每次往后找一个数,都减去0~i-k中的最小前缀和,看最大算出来的值是不是大于等于0,如果大于等于0就满

2016-03-27 21:45:09 505

原创 九度1497:面积最大的全1子矩阵 (单调队列,单调栈)

题目描述:在一个M * N的矩阵中,所有的元素只有0和1,从这个矩阵中找出一个面积最大的全1子矩阵,所谓最大是指元素1的个数最多。输入:输入可能包含多个测试样例。对于每个测试案例,输入的第一行是两个整数m、n(1矩阵共有m行,每行有n个整数,分别是0或1,相邻两数之间严格用一个空格隔开。输出:对应每个测试案例,输出矩阵中面积最

2016-03-26 18:42:51 771

原创 zjnu1726 STOGOVI (lca)

DescriptionMirko is playing with stacks. In the beginning of the game, he has an empty stack denoted with number 0. In theith step of the game he will choose an existing stack denoted with v, co

2016-03-25 20:06:38 481

原创 zjnu1735BOB (单调队列,单调栈)

DescriptionLittle Bob is a famous builder. He bought land and wants to build a house. Unfortunately, the problem is theland’s terrain, it has a variable elevation.The land is shaped like a rec

2016-03-24 13:38:01 609

原创 uva10859 Placing Lampposts (树形dp+求两者最小值方法)

题目链接:点击打开链接题意:给你一个n个点m条边的无向无环图,在尽量少的节点上放灯,使得所有边都被照亮,每盏灯将照亮以它为一个端点的所有边。在灯的总数最小的前提下,被两盏灯同时照亮的边数应尽量大。思路:无向无环图的另一个说法是“森林”,即由多棵树组成,我们可以先算一棵树上的答案,然后累加起来就行了。本题的优化目标有两个:放置的灯数应尽量少,被两盏灯照亮的边数b应尽量大。为了统一起见,我们把

2016-03-23 19:22:31 448

原创 zjnu1757Excellent (数学公式)

DescriptionLet us begin with a positive integer N and find the smallest positive integer which doesn't divide N. If we repeat the procedure with the resulting number, then again with the new res

2016-03-23 13:30:27 511

原创 zjnu1749 PAROVI (数位dp)

DescriptionThe distance between two integers is defined as the sum of the absolute result of subtracting their digits. For example, the distance between the numbers 4561 and 3278 is |4 – 3| + |5 -

2016-03-22 20:54:13 636

原创 zjnu1745 DOMINE (状压dp+1*2铺砖)

DescriptionMirko has a chessboard with N rows and just three columns. Slavica has written an integer on each field. Mirko has K dominoes at his disposal, their dimensions being 2x1, and has to arr

2016-03-22 15:19:25 932

原创 zjnu1762 U (线段树)

DescriptionMirko is hungry as a bear, scratch that, programmer and has stumbled upon a local restaurant. The restaurant offers N meals and has an interesting pricing policy: each meal i has two 

2016-03-21 16:37:11 495

原创 codeforces644B. Processing Queries (模拟)

In this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment ti and needs to be processed for di units of time. All

2016-03-21 15:35:06 600

原创 hdu4734 F(x) (数位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

2016-03-20 11:17:55 455

原创 hdu4352 XHXJ's LIS (数位dp)

Problem Description#define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then carefully reading the entire description is very important.As the strongest fighting force in UESTC,

2016-03-19 21:39:15 520

原创 hdu5643 King's Game(约瑟夫环+线段树)

Problem DescriptionIn order to remember history, King plans to play losephus problem in the parade gap.He calls n(1≤n≤5000) soldiers, counterclockwise in a circle, in label 1,2,3...n.The fir

2016-03-17 13:45:29 770 3

原创 hdu5637 Transform (bfs+预处理)

Problem DescriptionA list of n integers are given. For an integer x you can do the following operations:+ let the binary representation of x be b31b30...b0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯, you can flip o

2016-03-16 19:45:18 370

原创 Codeforces Round #345 (Div. 1) C. Table Compression (并查集)

Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression alg

2016-03-16 18:25:50 862

原创 uva10891 Game of Sum(博弈+区间dp+优化)

题目:点击打开链接题意:两个人做游戏,共有n个数,每个人可以任选一端取任意多连续的数,问两个人都想拿最多的情况下,先手最多比后手多拿多少分数。思路:这题一开始想到的是用dp[i][j]表示区间[i,j]内先手最多比后手多拿多少分数,那么状态转移方程为dp[i][j]=max(sum[j]-sum[i-1],dp[i][j],sum[k]-sum[i-1]-dp[k+1][j],sum[j]

2016-03-15 21:41:21 467

原创 zjnu1725 COCI (类似二维树状数组模拟)

DescriptionThe 3rd round of COCI is already here! In order to bet on predict the scores, we have assumed the following: If contestant A scored strictly more points than contestant B in each o

2016-03-15 19:16:25 550

原创 zjnu1730 PIRAMIDA(字符串,模拟)

DescriptionSample Input6JANJETINA51 J1 A6 N6 I5 ESample Output10211题意:给你一个长度小于等于10^6的字符串,然后每次让它循环铺盖,构成层数为n的塔,让你求得第i层塔中某个字符的个数。思路:首先要注意到字符串是从左到右覆盖该行和从右到做覆盖该行不影响结果,

2016-03-14 21:48:37 492

原创 hdu5365Shortest Path (floyd)

Problem DescriptionThere is a path graph G=(V,E) with n vertices. Vertices are numbered from 1 to n and there is an edge with unit length between i and i+1 (1≤in). To make the graph more int

2016-03-11 20:04:11 492

原创 表达式的转换 (模拟题)

做了三题表达式的转换题,都是先把中缀表达式转换为后缀表达式,然后再计算。zjnu1069 表达式的转换——中级Description平常我们书写的表达式称为中缀表达式,因为它将运算符放在两个操作数中间,许多情况下为了确定运算顺序,括号是不可少的,而中缀表达式就不必用括号了。 后缀标记法:书写表达式时采用运算紧跟在两个操作数之后,从而实现了无括号处理和优先级处理,使计算机的处理规

2016-03-11 14:11:52 1639

原创 zjnu1709 UZASTOPNI (bitset,树形dp)

DescriptionPetar is throwing a birthday party and he decided to invite some of the employees of his company where he is the CEO. Each employee, including Petar, has a unique label from 1 to N, a

2016-03-09 21:16:37 603

原创 zjnu1707 TOPOVI (map+模拟)

DescriptionMirko is a huge fan of chess and programming, but typical chess soon became boring for him, so he started having fun with rook pieces. He found a chessboard with N rows and N columns

2016-03-09 13:39:21 505

原创 zjnu1716 NEKAMELEONI (线段树)

Description"Hey! I have an awesome task with chameleons, 5 th task for Saturday’s competition.""Go ahead. . . "(...)“That’s too difficult, I have an easier one, they won’t even

2016-03-08 18:58:09 505

原创 zjnuSAVEZ (字符串hash)

DescriptionThere are eight planets and one planetoid in the Solar system. It is not a well known fact that there is a secret planet S4 inhabited by small creatures similar to bears, their codena

2016-03-06 21:50:26 468

原创 codeforces 55D. Beautiful numbers (数位dp)

Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue wi

2016-03-06 10:51:31 755

原创 hdu4507吉哥系列故事——恨7不成妻 (数位dp)

Problem Description  单身!  依然单身!  吉哥依然单身!  DS级码农吉哥依然单身!  所以,他生平最恨情人节,不管是214还是77,他都讨厌!    吉哥观察了214和77这两个数,发现:  2+1+4=7  7+7=7*2  77=7*11  最终,他发现原来这一切归根到底都是因为和7有关!所以,他现在甚至讨厌一切和7有关

2016-03-06 10:40:53 953

原创 hdu3652B-number (数位dp)

Problem DescriptionA wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbe

2016-03-04 17:37:09 424

原创 poj3252 Round Numbers (数位dp)

DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) i

2016-03-04 15:38:56 566

原创 hdu4920Matrix multiplication (矩阵,bitset)

Problem DescriptionGiven two matrices A and B of size n×n, find the product of them.bobo hates big integers. So you are only asked to find the result modulo 3. InputThe input con

2016-03-04 12:38:41 1082

原创 poj2443Set Operation (bitset)

DescriptionYou are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't entirely the same as the "set" defined in mathematics, and a set may contain two same element)

2016-03-04 09:32:48 544

原创 codeforces 632F. Magic Matrix (最小生成树)

You're given a matrix A of size n × n.Let's call the matrix with nonnegative elements magic if it is symmetric (so aij = aji), aii = 0 and aij ≤ max(aik, ajk) for all triples i, j, k. Note that 

2016-03-03 21:53:44 1525 3

原创 codeforces632E. Thief in a Shop (dp)

A thief made his way to a shop.As usual he has his lucky knapsack with him. The knapsack can contain k objects. There are n kinds of products in the shop and an infinite number of products of ea

2016-03-02 18:29:16 1000

原创 codeforces632D. Longest Subsequence (最小公倍数)

You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence o

2016-03-02 15:01:16 931 2

原创 Educational Codeforces Round 9 C. The Smallest String Concatenation(字符串排序)

You're given a list of n strings a1, a2, ..., an. You'd like to concatenate them together in some order such that the resulting string would be lexicographically smallest.Given the list of strin

2016-03-02 13:34:07 561

原创 hdu5407CRB and Candies (逆元+数学公式)

Problem DescriptionCRB has N different candies. He is going to eat K candies.He wonders how many combinations he can select.Can you answer his question for all K(0 ≤ K ≤ N)?CRB is too hu

2016-03-01 15:00:21 537

原创 hdu2669Romantic (扩展欧几里德)

Problem DescriptionThe Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk passing, and so are You. ..

2016-03-01 13:44:22 433

空空如也

空空如也

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

TA关注的人

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