自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Dust_heart的博客

Fly to sky, chase my dream!

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

转载 KMP (KMP+拓展KMP)算法总结

KMP算法KMP算法是一种线性时间复杂度的字符串匹配算法,它是对BF(Brute-Force,最基本的字符串匹配算法)的改进。对于给定的原始串S和模式串T,需要从字符串S中找到字符串T出现的位置的索引。KMP算法由D.E.Knuth与V.R.Pratt和J.H.Morris同时发现,因此人们称它为Knuth--Morris--Pratt算法,简称KMP算法。在讲解KMP算法之前,有必要对它的前

2017-05-28 20:58:57 1458 1

原创 反素数求解及相关题目

反素数定义:对于任何正整数n,其约数个数记为f(n),例如f(6)=4;如果存在一个正整数n满足:对于任意的正整数x(0<x<n),都有f(x)<f(n)成立,那么把n称为反素数。一个反素数的所有质因子必然是从2开始的若干个质数,因为一个数是反素数,说明在跟它约数相同的数中,它是最小的。如果n=2t1 * 3t2 * 5t3 *...,那么一定有t1>=t2>=t3&...

2017-05-26 18:27:48 3369 1

原创 最近公共祖先(LCA)算法实现过程 【Tarjan离线+倍增在线+RMQ】

最近公共祖先(LCA)首先来介绍下最近公共祖先(LCA)的概念百度上的解释:对于有根树T的两个结点u、v,最近公共祖先LCA(T,u,v)表示一个结点x,满足x是u、v的祖先且x的深度尽可能大。通俗语言:在一棵没有环的树上,每个节点肯定有其父亲节点和祖先节点,而最近公共祖先节点,就是两个节点在这棵树上深度最大的公共的祖先节点,即两个点在这棵树上距离最近的公共祖先节点

2017-05-24 22:31:47 17507 7

原创 最小生成树(Prim算法与Kruskal算法)

最小生成树:给定一个无向图,如果它的某个子图中任意两个顶点都相互连通并且是一棵树,那么这棵树就叫做生成树,如果边上有权值,那么使得边权和最小的生成树叫做最小生成树(MST)。- 解决MST问题主要会用到两种算法    1. Prim算法    2. Kruskal算法一、Prim算法算法实现思路1).输入:一个加权连通图,其中顶点集合为V

2017-05-20 21:44:21 1476

原创 ZJCOJ L先生与质数V3/V4 (Meisell-Lehmer算法)

Problem L: L先生与质数V4(应各位菊苣要求)Time Limit:1 Sec  Memory Limit:16 MBSubmit:298  Solved:65[Submit][Status][WebBoard]Description在解决了上一个质数问题之后,L先生依然不甘心,他还想计算下更多范围内的质数,你能帮助他吗?(没错这题题面和V3一毛一样)

2017-05-30 00:53:47 1308

原创 2017年浙江工业大学之江学院程序设计竞赛预赛

Problem A: L先生与晨跑Problem B: The name of the peopleProblem C: L先生与加密Problem D:朋友Z与方程Problem E: L先生的回信Problem F: L先生的信与路由Problem G: L先生的回信2Problem H: L先生运大米~Problem I: L先生与质数V1Problem J: L先生与质数V2Problem K: L先生与质数V3Problem L: L先生与质数V4(应各位菊苣要求)Prob

2017-05-29 19:45:36 1585

原创 HDOJ 3336 Count the string

It is well known that AekdyCoin is good at string problems as well as numbertheory problems. When given a string s, we can write down all the non-emptyprefixes of this string. For example:s: "abab"The prefixes are: "a", "ab", "aba","abab"For each prefix

2017-05-29 12:46:03 292

原创 HDOJ 1358 Period

For each prefix of a given string S with N characters (each character has an ASCIIcode between 97 and 126, inclusive), we want to know whether the prefix is aperiodic string. That is, for each i (2 <= i <= N) we want to know thelargest K > 1 (if there is o

2017-05-29 10:52:33 224

原创 POJ 3728 The merchant

POJ 3728 The merchantThere are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosensome paths and wants to earn as much money as possible in each path. When hemove along a path, he can choo

2017-05-28 11:36:26 505

原创 POJ 1986 Distance Queries && HDOJ 2586 How far away?

Distance QueriesTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 11677 Accepted: 4124Case Time Limit: 1000MSDescriptionFa

2017-05-25 16:50:14 514

原创 POJ 1330 Nearest Common Ancestors 【Tarjan+倍增+RMQ】

POJ 1330 Nearest Common Ancestors 【Tarjan+倍增+RMQ】A rooted tree is a well-knowndata structure in computer science and engineering. An example is shown below:、In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8is the root of th

2017-05-25 13:19:11 891 2

原创 HDOJ 1024 Max Sum Plus Plus

Max Sum Plus PlusTimeLimit: 2000/1000 MS (Java/Others)    Memory Limit:65536/32768 K (Java/Others)Total Submission(s): 28798    Accepted Submission(s): 10099Problem DescriptionNow I think

2017-05-24 19:40:53 364

原创 HDOJ 2489 Minimal Ratio Tree (Kruskal+Dfs)

Minimal Ratio TreeTimeLimit: 2000/1000 MS (Java/Others)    Memory Limit:32768/32768 K (Java/Others)Total Submission(s): 4294    Accepted Submission(s): 1360Problem DescriptionFor a tree,wh

2017-05-22 23:34:47 336

原创 HDOJ 1724 Ellipse(自适应simpson积分)

EllipseTimeLimit: 1000/1000 MS (Java/Others)    Memory Limit:32768/32768 K (Java/Others)Total Submission(s): 2025    Accepted Submission(s): 869Problem DescriptionMath isimportant!! Many s

2017-05-21 00:43:56 251

原创 About Contest and Trainning

May/14/2017 10:00~15:00JSCPC 江苏省省赛全程划水,完全就是我们队的一个坑。。。这场比赛+上一场CF+一场网络赛我的表现都很不好;我很努力地想让自己变得更好,虽然我思维能力不强,但我会花更多的时间去尝试,然而最近的效果让我比较失落,不仅学的东西比别人少,而且已经学的知识学得不精,也许是学习方法不对吧?也许是我真的很难去学一个新知识吧?反正我得更加努力了,马

2017-05-20 18:39:43 462

原创 二叉树及其遍历

二叉树:每个节点最多含有两个子树的树称为二叉树 完全二叉树:除最后一层无任何子节点外,每一层上的所有节点都有两个子节点的二叉树 满二叉树:除最后一层外,每一层上的节点数均达到最大值,在最后一层上只缺少右边的若干节点的二叉树 满二叉树肯定是完全二叉树,完全二叉树不一定是满二叉树 二叉树的遍历 先序遍历:也叫做先根遍历、前序遍历,首先访问根...

2017-05-20 09:36:48 319

原创 CF Round #413( Div.1/2) Fountains(线状数组查找)

C. Fountainstime limit per test2 secondsmemory limit per test256 megabytesArkady plays Gardenscapes a lot. Arkady wants to build two newfountains. There are n available fountains, fo

2017-05-19 22:08:57 305

原创 HDOJ 1285 确定比赛名次

确定比赛名次TimeLimit: 2000/1000 MS (Java/Others)    Memory Limit:65536/32768 K (Java/Others)Total Submission(s): 25709    Accepted Submission(s): 10340Problem Description有N个比赛队(1  Input

2017-05-13 10:20:54 232

原创 HDOJ 1435 Stable Match

Stable MatchTimeLimit: 2000/1000 MS (Java/Others)    Memory Limit:65536/32768 K (Java/Others)Total Submission(s): 744    Accepted Submission(s): 354Special JudgeProblem DescriptionNetwork公司的

2017-05-13 10:14:27 344

原创 HDOJ 1522 Marriage is Stable

Marriage is StableTimeLimit: 2000/1000 MS (Java/Others)    Memory Limit:65536/32768 K (Java/Others)Total Submission(s): 1173    Accepted Submission(s): 624Special JudgeProblem DescriptionAlb

2017-05-13 10:10:06 298

原创 HDOJ 1914 The Stable Marriage Problem

The Stable Marriage ProblemTimeLimit: 5000/1000 MS (Java/Others)    Memory Limit:65535/32768 K (Java/Others)Total Submission(s): 881    Accepted Submission(s): 445Problem DescriptionThe st

2017-05-13 10:07:52 315

原创 CF Round #413( Div.1/2) Field expansion

D. Field expansiontime limit per test  1 secondmemory limit per test 256 megabytesinput  standard inputoutput standard outputIn one of the games Arkady is fond ofthe game process h

2017-05-12 15:17:10 516

原创 HDOJ 3790 最短路径问题(双关键字最短路)

最短路径问题Time Limit: 2000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 26248    Accepted Submission(s): 7810Problem Description给你n个点,m条无向边,每条边都有长度d和花费

2017-05-10 00:27:21 449

原创 HDOJ 1142 A Walk Through the Forest(最短路+记忆化搜索)

A Walk Through the ForestTime Limit: 2000/1000 MS(Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8599    Accepted Submission(s): 3181Problem DescriptionJimmy

2017-05-09 00:30:32 337

原创 HDOJ 3339 In Action(最短路+01背包)

In ActionTime Limit: 2000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5977    Accepted Submission(s): 2010Problem DescriptionSince 1945, when the

2017-05-08 22:48:59 294

原创 CF Round #412( Div.2) Success Rate

C. Success Ratetime limit per test 2 secondsmemory limit per test256 megabytesYou are an experienced Codeforces user.Today you found out that during your activity on Codeforces you hav

2017-05-08 01:41:10 405

原创 2017 CCPC-WFinal&&HDOJ 6030 Happy Necklace(矩阵快速幂)

Happy NecklaceTime Limit: 2000/1000 MS(Java/Others)    Memory Limit: 131072/131072 K(Java/Others)Total Submission(s): 0    Accepted Submission(s): 0Problem DescriptionLittle Q wants to buy

2017-05-07 17:01:35 400

原创 2017 CCPC-WFinal&&HDOJ 6024 Building Shops

HDU’s n classrooms are on a line ,which can be considered as a number line.Each classroom has a coordinate. Now Little Q wants to build several candyshops in thesen classrooms.The total cost consists of two parts. Building a candy shop at classroom i wou

2017-05-07 14:49:50 919

原创 2017 CCPC-WFinal&&HDOJ6025 Coprime Sequence(前缀后缀GCD问题)

Do you know what is called``Coprime Sequence''? That is a sequence consists ofn positive integers, and the GCD (Greatest Common Divisor) of them is equal to 1.“Coprime Sequence'' is easy to find because of its restriction. But we can tryto maximize the GC

2017-05-07 13:03:16 1400

原创 ZOJ 3954 Seven-Segment Display

InputOutputSample InputSample OutputHintSeven-Segment DisplayTime Limit: 1 Second      Memory Limit: 65536 KB      A seven segment display, or seven segment indicator, is a form of elect

2017-05-06 00:30:46 293

原创 ZOJ Seven Segment Display

Seven Segment DisplayTimeLimit:2 Seconds      Memory Limit:65536 KB A seven segment display, or seven segment indicator, is a form of electronicdisplay device for displaying decima

2017-05-05 21:03:06 334

原创 CF Round #411 (Div. 2) Minimum number of steps

D. Minimum number of stepstime limit per test1 secondmemory limit per test256 megabytesWe have a string of letters 'a' and 'b'. We want toperform some operations on it. On each ste

2017-05-05 16:28:51 519

原创 HDOJ 2585 maximum shortest distance(求最大团+二分)

maximum shortest distanceTime Limit: 2000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1879    Accepted Submission(s): 643Problem DescriptionThere

2017-05-04 20:55:23 322

原创 HDOJ 1530 Maximum Clique(最大团模板题)

Maximum CliqueTime Limit: 20000/10000 MS(Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4365    Accepted Submission(s): 2313Problem DescriptionGiven a graph

2017-05-04 16:50:09 576

原创 HDOJ 1850 Being a Good Boy in Spring Festival(Nim博弈)

Being a GoodBoy in Spring FestivalTime Limit: 1000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7380    Accepted Submission(s): 4488Problem Descripti

2017-05-04 01:06:33 237

原创 HDOJ 1848 Fibonacci again and again(SG函数)

Fibonacciagain and againTime Limit: 1000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8754    Accepted Submission(s): 3637Problem Description任何一个大学

2017-05-04 00:30:20 337

原创 HDOJ 1527 取石子游戏(威佐夫博奕)

取石子游戏Time Limit: 2000/1000 MS(Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7095    Accepted Submission(s): 3884Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮

2017-05-03 23:22:30 234

原创 HDOJ 1517 A Multiplication Game

A Multiplication GameTime Limit: 5000/1000 MS(Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5844    Accepted Submission(s): 3311Problem DescriptionStan and

2017-05-03 21:54:19 182

原创 HDOJ 3480 Division(斜率优化DP)

DivisionTime Limit: 10000/5000 MS(Java/Others)    Memory Limit: 999999/400000 K(Java/Others)Total Submission(s): 4743    Accepted Submission(s): 1842Problem DescriptionLittle D is really i

2017-05-01 12:52:49 239

空空如也

空空如也

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

TA关注的人

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