自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 lightoj 1283 1283 - Shelving Books(dp)

#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;int INF = 0x3f3f3f3f;const int N = 1e2 + 10;int dp[N][N][N], a[N], b[N], c

2016-05-20 23:16:29 635

原创 51nod 1455 宝石猎人(dp or 记忆化搜索)

苏塞克岛是一个有着30001个小岛的群岛,这些小岛沿着一条直线均匀间隔分布,从西到东编号为0到30000。众所周知,这些岛上有很多宝石,在苏塞克岛上总共有n颗宝石,并且第i颗宝石位于岛 pi上。小法正好到达0号小岛上,他拥有卓越的跳跃能力,能根据以下规则在小岛之间向东重复跳跃:·        首先,他会从0号岛跳到d号岛·        此后,他会根据以下规则继续跳跃,L

2016-05-09 12:03:45 1027

原创 51nod 1405 树的距离之和

给定一棵无根树,假设它有n个节点,节点编号从1到n, 求任意两点之间的距离(最短路径)之和。Input第一行包含一个正整数n (n <= 100000),表示节点个数。后面(n - 1)行,每行两个整数表示树的边。Output每行一个整数,第i(i = 1,2,...n)行表示所有节点到第i个点的距离之和。Input示例41 23 24 2

2016-05-07 11:13:15 901

原创 51nod 1732 51nod婚姻介绍所

51nod除了在做OJ之外,还开展了很多副业。婚姻介绍所就是其中之一。对于一个客户,我们可以使用一个字符串来描述该客户的特质。假设现在我们有两个客户A和B。A的特质字符串为:abcdefgB的特质字符串为:abcxyz则A和B的匹配度f(A, B)为A和B的最长公共前缀的长度,即len('abc') = 3由于最近51nod经费紧张,

2016-05-06 11:23:50 994

原创 51nod 1640 天气晴朗的魔法

51nod魔法学校近日开展了主题为“天气晴朗”的魔法交流活动。N名魔法师按阵法站好,之后选取N - 1条魔法链将所有魔法师的魔力连接起来,形成一个魔法阵。魔法链是做法成功与否的关键。每一条魔法链都有一个魔力值V,魔法最终的效果取决于阵中所有魔法链的魔力值的和。由于逆天改命的魔法过于暴力,所以我们要求阵中的魔法链的魔力值最大值尽可能的小,与此同时,魔力值之和要尽可

2016-05-06 11:02:14 1044

原创 51nod 1478 括号序列的最长合法子段

这里有另一个关于处理合法的括号序列的问题。如果插入“+”和“1”到一个括号序列,我们能得到一个正确的数学表达式,我们就认为这个括号序列是合法的。例如,序列"(())()", "()"和"(()(()))"是合法的,但是")(", "(()"和"(()))("是不合法的。这里有一个只包含“(”和“)”的字符串,你需要去找到最长的合法括号子段,同时你要找到拥有最长长度的子段串的个数。

2016-05-05 11:26:12 1353

原创 51nod 1624 取余最长路

佳佳有一个n*m的带权矩阵,她想从(1,1)出发走到(n,m)且只能往右往下移动,她能得到的娱乐值为所经过的位置的权的总和。有一天,她被下了恶毒的诅咒,这个诅咒的作用是将她的娱乐值变为对p取模后的值,这让佳佳十分的不开心,因为她无法找到一条能使她得到最大娱乐值的路径了!她发现这个问题实在是太困难了,既然这样,那就只在3*n的矩阵内进行游戏吧!现在的问题是,在一个3*n的带权

2016-05-05 11:20:03 1077

原创 HDU 5677 ztr loves substring (dp)

Problem Descriptionztr love reserach substring.Today ,he has n string.Now ztr want to konw,can he take out exactly k palindrome from all substring of these n string,and thrn sum of length of these

2016-05-01 12:08:07 972 4

原创 HDU 5676

Problem Descriptionztr loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744

2016-05-01 09:59:51 487

原创 HDU 5671 Matrix

MatrixTime Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 477    Accepted Submission(s): 207Problem DescriptionThere is a matrix M

2016-04-23 20:48:17 430

原创 HDU 5672 String(尺取法)

Problem DescriptionThere is a string S.S only contain lower case English character.(10≤length(S)≤1,000,000)How many substrings there are that contain at least k(1≤k≤26) distinct characters?

2016-04-23 12:28:37 1104

原创 lightoj 1017 - Brush (III)(dp)

1017 - Brush (III)   PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBSamir returned home from the contest and got angry after seei

2016-04-09 10:25:34 369

原创 lightoj 1122 - Digit Count(dp)

Time Limit: 2 second(s)Memory Limit: 32 MBGiven a set of digits S, and an integer n, you have to find how many n-digit integers are there, which contain digits that belong to S and the d

2016-04-07 22:41:09 751

原创 lightoj 1033 - Generating Palindromes(区间dp)

1033 - Generating Palindromes   PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBBy definition palindrome is a string which is not

2016-04-07 22:33:24 702

原创 lightoj 1011 - Marriage Ceremonies(状态压缩dp)

Time Limit: 2 second(s)Memory Limit: 32 MBYou work in a company which organizes marriages. Marriages are not that easy to be made, so, the job is quite hard for you.The job gets more d

2016-04-02 12:21:48 556

原创 lightoj 1005 ROOKS(组合数)

A rook is a piece used in the game of chess which is played on a board of square grids. A rook can only move vertically or horizontally from its current position and two rooks attack each other if one

2016-04-01 21:27:24 434

原创 codeforces 659E New Reform

E. New Reformtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland has n cities connected by m bidirectio

2016-04-01 20:41:48 740

转载 poj 题目分类 很好很有层次感

转自kuangbin博客园。初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2

2016-02-22 21:15:51 1259

原创 Codeforces Round #343 (Div. 2) D. Babaei and Birthday Cake(离散化+线段树)

D. Babaei and Birthday Caketime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, every birthday par

2016-02-21 10:05:42 681

原创 HDU 2476 String painter(区间dp)

Problem DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can ch

2016-02-20 14:50:28 546

原创 poj 3280 Cheapest Palindrome(区间dp)

题目链接:http://poj.org/problem?id=3280;题意:给你一个字符串,然后给你一个字符表,里面有删除和添加这个字符的代价,问你把他最后变成回文串的最小代价。思路:我们可以dp[i][j]表示从第i个字符到第j个字符变成回文串的最小代价,然后对应dp[i+1][j]和dp[i][j-1]我们可以选择删除和添加对应字符的最小代价,如果s[i] == s[j] 的话,就直

2016-02-17 10:24:57 530

原创 UVALive - 3942 Remember the Word(trie + dp)

题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=22109;思路:dp[i]表示原串从i开始的后段子串的方案数,从后往前dp,然后dp[i] = sum(dp[i + len(x)],这里的x是给出单词并且是这后段的前缀串。如果直接枚举的话会超时,先把单词全部加到字典树上面然后在字典树上面查找就可以了。我是用指针

2016-02-16 15:36:26 665

原创 HDU 5627 Clarke and MST

问题描述克拉克是一名人格分裂患者。某一天克拉克变成了一名图论研究者。 他学习了最小生成树的几个算法,于是突发奇想,想做一个位运算and的最大生成树。 一棵生成树是由n-1n−1条边组成的,且nn个点两两可达。一棵生成树的大小等于所有在生成树上的边的权值经过位运算and后得到的数。 现在他想找出最大的生成树。输入描述第一行是一个整数T(1 \le T \le 5)T(1≤

2016-02-14 13:51:19 616

原创 HDU 1195 Open the Lock(bfs or 双向bfs)

Open the LockTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5613    Accepted Submission(s): 2492Problem DescriptionNow an emerg

2016-02-02 12:51:33 387

原创 HDU 5616 Jam's balance(dp)

Jam's balanceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 356    Accepted Submission(s): 163Problem DescriptionJim has a bala

2016-01-31 20:45:27 921 2

原创 HDU 3001 Travelling(状态压缩dp)

TravellingTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5765    Accepted Submission(s): 1858Problem DescriptionAfter coding so

2016-01-29 19:36:17 712

原创 HDU 3091 Necklace (状态压缩dp)

#include#include#include#include#include#include#include#include#includeusing namespace std;const int N = (1<<18) + 10;const double eps = 1e-10;typedef long long ll;ll dp[N][20];int Map[

2016-01-28 18:50:29 552

原创 HDOJ 5613 Baby Ming and Binary image

问题描述铭宝宝很喜欢像素图,所以,他喜欢把像素图都做如下的处理:首先,把像素图变换成二值图(用0101表示),然后,在二值图中,把每个点以及和它相邻的点(最多99个点)的0101值加起来,并保存在一个矩阵Mat中。铭宝宝选择的图像底边和顶边都是空白的(二值图中值为00),因为他觉得这样的图很漂亮。不过因为矩阵很大,铭宝宝担心记录过程中出错。所以现在铭宝宝想知道,根据他所保存下来的矩阵Ma

2016-01-24 20:19:01 333

原创 HDU 5612 Baby Ming and Matrix games(dfs搜索)

问题描述铭宝宝喜欢玩游戏,这两天他喜欢玩下面这个游戏了。给出一个n*mn∗m的矩阵,矩阵的(i*2,j*2)(i∗2,j∗2) (其中i, j = 0, 1, 2...i,j=0,1,2...) 位置上为0~9的数字,矩阵中每两个数字中间有一个算术符号(+、-、*、/),其他位置用#填充。问题是:是否能在上述矩阵中,找到一个表达式,使得表达式的计算结果为给出的sum(表达式从左到右计算)

2016-01-24 13:41:35 525

原创 fzuoj 2218 Simple String Problem(状态压缩dp)

Problem 2218 Simple String ProblemAccept: 10    Submit: 40Time Limit: 2000 mSec    Memory Limit : 32768 KB Problem DescriptionRecently, you have found your interest in string theory. H

2015-12-29 21:14:09 1066

原创 HDU 1045 Fire Net (dfs 或 二分图)

Fire NetTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8595    Accepted Submission(s): 4970Problem DescriptionSuppose that we h

2015-12-18 15:26:26 537

原创 HDU 1026 Ignatius and the Princess I(优先队列bfs)

题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1026;题意:给你一个地图,上面有障碍和怪兽,障碍不可以走,怪兽有hp值,每点hp有消耗一秒时间去攻击,起点在(0,0),终点在(n-1, m-1),还要把路径输出.#include#include#include#include#include#include#include

2015-12-18 13:02:11 474

原创 hdu 5592 ZYB's Premutation(线段树查询第k大的数)

ZYB's PremutationTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 464    Accepted Submission(s): 228Problem DescriptionZYB has

2015-12-07 12:48:31 356

原创 POJ 1661Help Jimmy(dp)

Help JimmyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9708 Accepted: 3147Description"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台

2015-12-04 22:48:05 325

原创 第二次随机组队总结

第二次随机组队,这次的题目是学长自己出的题目,题目还是比较简单的,不过,这么简单的题目我们居然没有ak,还是太弱了,而且还是中文题面,囧。。每道题目都错了一遍真是醉了,都是一些粗心的错误,输出的时候漏了一个数之类的,强行不加abs。。和队友的沟通还是不太好,队友有思路,但是代码能力不够翘不出来,我居然不去敲,也是我的锅,没太理解队友的思路。由于集训队的巨巨们都去区域赛了,还有其它学校的

2015-11-23 17:08:09 448

原创 hdu 5569 matrix(dp)

matrixTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 329    Accepted Submission(s): 199Problem DescriptionGiven a matrix with n

2015-11-23 16:59:12 288

原创 hdu5568 sequence2(dp + 高精度)

sequence2Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 385    Accepted Submission(s): 151Problem DescriptionGiven an integer a

2015-11-23 16:52:03 302

原创 Codeforces Round #332 (Div. 2) C. Day at the Beach

C. Day at the Beachtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Squidward, Spongebob and Patric

2015-11-21 10:43:15 333

原创 2063 过山车(匈牙利算法-二分图最大匹配)

过山车Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15250    Accepted Submission(s): 6684Problem DescriptionRPG girls今天和大家一起去游乐场玩

2015-11-19 21:29:03 418

原创 hiho 1249 Xiongnu's Land

分割线要满足三个条件:1. 左边的绿洲面积要大于等于右边的绿洲面积。2.两边的面积的差值要尽可能的小。3.左边的总面积要尽可能的大于右边。思路:先二分答案求出条件一和二满足的最左边的分割线,然后二分答案满足条件最右边的分割线。本来写了一发线段树的,结果写搓了。。。。#include#include#include#include#include#include#

2015-11-18 20:34:22 377

空空如也

空空如也

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

TA关注的人

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