自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 资源 (6)
  • 收藏
  • 关注

原创 拓扑排序+线段树(hdu5195)

DZY Loves Topological SortingAccepts: 112Submissions: 586Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)问题描述一张有向图的拓扑序列是图中点的一个排列,满足对于图中的每条有向边(u→v

2015-03-29 12:02:57 544

原创 chmod

#include#include#include#include#includeint cnt;void printdir(char *dir){ DIR *dp; struct dirent *entry; struct stat buf; if((dp=opendir(dir))==NULL) { chmod(dir,S_IRUSR|S_IWUSR|S_IXUSR|

2015-03-28 22:18:01 398

原创 dp(UVa 10604 - Chemical Reaction)

Chemical ReactionTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmitStatus DescriptionProblem EChemical Reaction In a ch

2015-03-28 16:39:15 733

原创 动态树LCT||树链剖分+线段树(SPOJ QTREE3 - Query on a tree again!)

QTREE3 - Query on a tree again!no tags EnglishVietnameseYou are given a tree (an acyclic undirected connected graph) with N nodes. The tree nodes are numbered from 1 to N.

2015-03-28 14:02:04 901

原创 动态树LCT(SPOJ QTREE2 - Query on a tree II)

QTREE2 - Query on a tree IIno tags You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned to i

2015-03-27 17:21:35 602

原创 中途相与法(Codeforces Round #297 (Div. 2)E - Anya and Cubes )

E. Anya and Cubestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya loves to fold and stick. Today she decided to

2015-03-27 16:03:46 562

原创 动态树LCT(SPOJ375)

原来用树链剖分写过,最近学动态树,从写一遍题意:改变边权值,询问连点之间边权的最大值思路:这个题维护的是边权,我是吧边权转化为点权,这样需要注意的是不能换根,因为换根之后权值就变了那么如何解决那,就要用到LCA了,LCA的时候先Access(v),使得v到根的路径暴露出来,形成一颗Splay,然后u沿着pre向上走,知道走到v到根的脸上,说明找到了LCA,因为这个时候Splay(LCA

2015-03-24 14:57:24 806

原创 动态树LCT||分块(BZOJ2002)

2002: [Hnoi2010]Bounce 弹飞绵羊Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 4721  Solved: 2503[Submit][Status][Discuss]Description某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏。游戏一开始

2015-03-23 17:55:35 492

原创 bfs最短路+dp(FZU 2186)

Problem 2186 小明的迷宫Accept: 45    Submit: 138Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description小明误入迷宫,塞翁失马焉知非福,原来在迷宫中还藏着一些财宝,小明想获得所有的财宝并离开迷宫。因为小明还是学生,还有家庭作业要做,所以他想尽快获得所

2015-03-23 17:11:47 547

原创 带权并查集(hdu2818)

Building BlockTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3552    Accepted Submission(s): 1067Problem DescriptionJohn are playin

2015-03-22 21:23:48 362

原创 LCT(模板题)BZOJ2049

2049: [Sdoi2008]Cave 洞穴勘测Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 3769  Solved: 1680[Submit][Status][Discuss]Description辉辉热衷于洞穴勘测。某天,他按照地图来到了一片被标记为JSZX的洞穴群地区。经过初步勘测,辉辉发现这片区域由n个洞穴(

2015-03-22 10:52:01 646

原创 记忆化搜索dp(UVa - 10118 Free Candies)

题意:有4堆糖果,每堆有n个,有一个篮子,最多装5个糖果,我们每次拿某一堆糖果最上面的一个,如果篮子里有两个相同的糖果,那么就可以把这一对糖果放进自己的口袋里,问最多能拿走多少对糖果。思路:dp[a][b][c][d]表示对应堆的糖果拿走a,b,c,d个后,口袋里最多有多少糖果,对于篮子装满的情况dp值为0,记忆话搜索。#include#include#include#include

2015-03-21 15:06:11 464

原创 dp(UVa - 10626 Buying Coke)

题意:有1,5,10三种硬币,要买c灌可乐,每灌可乐8元,机器会给你找最少个数的钱来组合最多的钱,问最少要投多少硬币思路:dp[i][j][k]表示i个1元钱硬币,j个5元钱硬币,k个10元钱硬币,买n灌可乐最少投币多少,可以得到状态转移方程,具体见代码#include#include#include#include#include#include#include#inclu

2015-03-21 14:25:21 472

原创 动态树hdu4010 - Query on The Trees

Query on The TreesTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 3027    Accepted Submission(s): 1380Problem DescriptionWe have me

2015-03-20 19:41:45 446

原创 动态树模板

数组版(kuangbin):#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;const int maxn=300010;int ch[maxn][2],pre[maxn],key[maxn];int

2015-03-20 17:40:00 476

原创 dp( UVa 662 Fast Food )

题意:有n家餐馆,有m个仓库,给出每个餐馆的坐标,0,0表示结束,求餐馆到离它最近仓库的距离和最小,注意仓库都是建立在餐馆上的。输出的时候,要把每个仓库离它最近的餐馆输出。思路:对于区间(i,j)的餐厅,如果选择一个作为仓库的话,肯定是悬在中位数上,d[i][j]表示区间(i,j)选择一个仓库总的距离和,dp[i][j]表示前j个餐厅建立i个仓库的最小距离那么 dp[i][j]=min(d

2015-03-20 15:48:57 395

原创 dp(UVa10564 - Paths through the Hourglass)

Problem FPaths through the HourglassInput: Standard Input Output: Standard Output Time Limit: 2 Seconds In the hourglass to the right a path is marked. A path always starts at the first row

2015-03-20 14:51:04 705

原创 dp(good)UVa10401 - Injured Queen Problem

题意:给出一个字符串,要求在n * n(n为字符串的长度)的棋盘上摆放n个受伤的皇后,受伤的皇后只能攻击到同一列和它周围8个格子,如果字符串中第i个字符为'?'表示第i 个皇后可以摆放在任意行,如果为1 ~ F表示第i个皇后必须摆放在第1~F行, 问,相互不能攻击到有多少种不同的摆法?思路:dp[i][j]表示当前皇后放在第i行,j列总共有多少种方法dp[i][j]=dp[i-1][k](

2015-03-19 17:17:28 456

原创 dp(整数拆分 uva10313 - Pay the Price)

题意:如果给出一个数,输出这个数拆分成1~300份的方法数,如果是两个数则输出这个数拆分成1~a份的方法数,如果是三个数输出这个数拆分成a~b份的方法数思路:f[i][j],表示整数j拆分成i个元素的方法数,dp[i][j]表示整数j拆分成小于等于i个数的方法数则:dp[i][j]=dp[i-1][j]+f[i][j];输入处理用sscanf(好强大)#include#inclu

2015-03-19 16:35:52 722

原创 dp+二分(uva-10029Edit Step Ladders)

题意:求一个最长的序列,使得序列中第i个字符串只通过一次变化可以变为第i+1个字符串思路:枚举每个字符穿的变化情况,然后类似于求最长上升子序列的方法求解#include#include#include#include#include#include#include#include#include#include#includeusing namespace

2015-03-19 15:54:16 457

原创 构造字符串(hdu2970Suffix reconstruction)

Suffix reconstructionTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 278    Accepted Submission(s): 150Problem DescriptionGiven a t

2015-03-18 22:56:04 503

原创 记忆话搜索dp(uva10453)

题意:最少插入多少个字符,可以使得字符串成为回文字符串,并打印出字符串#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;const int maxn=1010;char str[maxn];int

2015-03-18 22:53:31 442

原创 贪心(最大团)||dp+线段树(Codeforces Round #296 (Div. 2)D. Clique Problem)

D. Clique Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe clique problem is one of the most well-known NP

2015-03-18 22:25:42 489

原创 k-d树(hdu2966)

In case of failureTime Limit: 60000/30000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1505    Accepted Submission(s): 589Problem DescriptionTo help th

2015-03-16 17:36:21 1003

原创 数学(快速幂+快速加法 hdu5187-zhx's contest)

zhx's contestTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 562    Accepted Submission(s): 177Problem DescriptionAs one of the most

2015-03-15 10:55:20 775

原创 dp(uva10201Adventures in Moving - Part IV)

题意:有一辆车,原始装有100L汽油,到达距离为d的目的地,中间有x个加油站,每升油的价格为p。汽车每跑一公里耗油1L,求到达目的地油箱仍然有100L的最小花费。车的最大容量为200思路:dp[i][j]表示从第i个加油站出发时,邮箱里有j省油的最小花费那么可以得到递推公式,首先dp[i][j]最小值从dp[i-1][j+tmp]推得,在第i个加油站,可以选择加k省油(0),得到从i出

2015-03-14 17:36:43 428

原创 回文串数dp(uvaAgain Palindromes )

Problem I Again Palindromes Input: Standard Input Output: Standard OutputTime Limit: 2 Seconds A palindorme is a sequence of one or more characters that reads the same from the left as i

2015-03-14 16:09:57 629

原创 最长回文串dp(uva11151 - Longest Palindrome)

Longest PalindromeTime Limit:3000MS Memory Limit:Unknown 64bit IO Format:%lld & %lluSubmitStatusDescriptionProblem D: Longest PalindromeTime l

2015-03-14 15:02:49 871

原创 dp(hdu5185-Equation)

Problem DescriptionGorwin is very interested in equations. Nowadays she gets an equation like thisx1+x2+x3+⋯+xn=n, and here 0≤xi≤nfor1≤i≤nxi≤xi+1≤xi+1for1≤i≤n−1For a certain n, Gorwin wa

2015-03-13 16:32:49 427

原创 dp(uva10271)

题意:给出n只筷子的长度,需要组成k+8个三元组(x,y,z),其中x思路:dp[i][j]表示前i只筷子组成j组最小代价dp[i][j]=min(dp[i-1][j],dp[i-2][j-1]+cost),表示不用第i只组成第j组,用第i只组成第j组筷子的长度要按照从大到小排,因为这样才能保证如果剩下了可以作为某一组中最长的那根,不影响结果#include#include

2015-03-13 15:53:08 360

原创 区间dp(uva10304-Optimal Binary Search Tree)

题意:给一个序列,序列从小到大排序,要把这些树构成一个二叉搜索树。 要求sum = f(e1)*cost(e1) + f(e2)*cost(e2) + ... + f(en)*cost(en),sum值最小。其中f表示数的频率,cost表示数在树种的深度(从0开始)思路:枚举根节点,设ei为根节点,在序列中ei左边的所有数会构成ei的左子树,ei的右边的所有数会构成ei的右子树,从中选

2015-03-13 14:56:08 414

原创 记忆化搜索dp(uva10739)

题意:给定一个字符串,可以进行添加、删除、替换字符使其成为回文串,问最少的操作次数是多少思路:记忆话搜索,dp[i][j]表示区间(i,j)变成回文串所需要的最少次数如果str[i]==str[j],则dp[i][j]=dp[i+1][j-1],否则dp[i][j]=min{dp[i][j-1](在i端插入),dp[i+1][j](在j端插入),dp[i+1][j-1](替换)}插入和

2015-03-13 14:48:31 691

原创 dp(good)uva10306e-Coins

e-CoinsTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmitStatus DescriptionProblem Ge-Coins Input: standard input Output: stand

2015-03-11 22:35:37 390

原创 dp(uva590Always on the run)

Always on the runTime Limit:3000MS Memory Limit:Unknown 64bit IO Format:%lld & %lluSubmitStatusDescriptionScreeching tires. Searching lights. Wailing sirens. Poli

2015-03-11 21:41:20 440

原创 替罪羊树模板(BZOJ3224)

模板是转自kuangbin大神,膜拜#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;const int maxn=100010;const double alpha=0.75;int N;struc

2015-03-09 22:34:52 2476 2

原创 递推dp(uva10404)

Bachet's GameTime Limit:6666MS Memory Limit:Unknown 64bit IO Format:%lld & %lluSubmitStatusDescriptionProblem B: Bachet's Game Bachet's game is probably known t

2015-03-09 20:49:41 503

原创 手写hash(hdu5183Negative and Positive (NP))

Negative and Positive (NP)Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1161    Accepted Submission(s): 59Problem DescriptionW

2015-03-08 22:14:20 750

原创 左偏树(BZOJ2809)

思路:dfs,如果总和超过M,就把树根丢掉#include#include#include#include#include#include#include#include#include#include#include#define null 0using namespace std;typedef long long LL;const int maxn=40001

2015-03-07 16:27:08 456

原创 左偏树模板

#define null -1struct Node{ int key; int l,r,f,dis;}tree[maxn];//得到节点标号为r的节点的跟节点编号int getroot(int r){ if(r==null)return r; while(tree[r].f!=null) r=tree[r].f; return

2015-03-07 13:58:26 628

原创 左偏树学习

下面介绍下左偏树。(转自:点击打开链接)(1)什么是左偏树?左偏树是一个二叉树,节点至少有两个属性val和dis。val是节点的键值。整个左偏树满足任意一个节点的键值小于其左右子树的键值(显然这里小于还是大于要看具体的题目),也就是根节点的键值是整棵树最小的。对于dis,我们首先定义:若一个节点的左右孩子有一个为NULL,则该节点的dis=0,否则该节点的dis等于左右孩子dis值小的那个加1

2015-03-07 11:41:40 498

高效awk编程

awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在其对数据分析并生成报告时,显得尤为强大。简单来说awk就是把文件逐行的读入,以空格为默认分隔符将每行切片,切开的部分再进行各种分析处理。 awk有3个不同版本: awk、nawk和gawk,未作特别说明,一般指gawk,gawk 是 AWK 的 GNU 版本。 awk其名称得自于它的创始人 Alfred Aho 、Peter Weinberger 和 Brian Kernighan 姓氏的首个字母。实际上 AWK 的确拥有自己的语言: AWK 程序设计语言 , 三位创建者已将它正式定义为“样式扫描和处理语言”。它允许您创建简短的程序,这些程序读取输入文件、为数据排序、处理数据、对输入执行计算以及生成报表,还有无数其他的功能。

2018-06-03

hadoop-eclipse-plugin-2.7.2.jar

2016-03-19

空空如也

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

TA关注的人

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