自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU 2236 无题II(二分图匹配+二分)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2236Problem Description这是一个简单的游戏,在一个n*n的矩阵中,找n个数使得这n个数都在不同的行和列里并且要求这n个数中的最大值和最小值的差值最小。 Input输入一个整数T表示T组数据。对于每组数据第一行输入一个正整数n(1<=n<=100)表示矩阵的大小。接着输入n...

2018-04-30 21:40:22 199

原创 poj 3686 The Windy's(KM算法)

题目链接:http://poj.org/problem?id=3686DescriptionThe Windy's is a world famous toy factory that owns M top-class workshop to make toys. This year the manager receives N orders for toys. The manager knows...

2018-04-30 20:50:09 142

原创 POJ 2195 Going Home(二分图最小匹配,KM算法)

题目链接:http://poj.org/problem?id=2195DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an a...

2018-04-30 19:45:51 174

原创 POJ 3565 Ants(二分图最小权匹配,KM算法)

题目链接:http://poj.org/problem?id=3565DescriptionYoung naturalist Bill studies ants in school. His ants feed on plant-louses that live on apple trees. Each ant colony needs its own apple tree to feed its...

2018-04-30 18:24:31 272

原创 HDU 2255 奔小康赚大钱(KM算法)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2255Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到...

2018-04-25 20:30:29 145

原创 POJ 3041 Asteroids(二分图匹配)

题目链接:http://poj.org/problem?id=3041DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroi...

2018-04-24 20:07:00 126

原创 POJ 1469 COURSES(二分图匹配)

题目链接:http://poj.org/problem?id=1469DescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to ...

2018-04-24 17:42:53 120

原创 HDU 2389 Rain on your Parade(二分图匹配的hopcroft-carp算法)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2389Problem DescriptionYou’re giving a party in the garden of your villa by the sea. The party is a huge success, and everyone is here. It’s a warm, sunn...

2018-04-24 17:04:44 227

原创 HDU 3349 lazy gege(水题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3349Problem DescriptionGege hasn't tidied his desk for long,now his desk is full of things.This morning Gege bought a notebook,while to find somewhise to...

2018-04-23 20:40:36 217

原创 HDU 2609 How many(最小表示法)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2609Problem DescriptionGive you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell meHow many kinds of necklaces total have...

2018-04-22 22:08:50 112

原创 HDU 4162 Shape Number(最小表示法)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4162Problem DescriptionIn computer vision, a chain code is a sequence of numbers representing directions when following the contour of an object. For exa...

2018-04-22 21:48:07 262

原创 HDU 2063 过山车 (二分图最大匹配)

题目链接:http://acm.hdu.edu.cn/viewcode.php?rid=24466075Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或P...

2018-04-22 21:06:25 156

原创 二分图匹配模板(匈牙利算法、hopcroft-carp算法、KM算法)

匈牙利算法(Hungarian method)是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是二分图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。二分图的一些性质:1.最小点覆盖=最大匹配。 定义:点覆盖是图中一些点的集合,且对于图中所有的边,至少有一个端点属于点覆盖,点数最小的覆盖就是最小点...

2018-04-22 21:03:34 870

原创 最小表示法/最大表示法

给定字符串,这个字符串是循环的,要求寻找一个位置,以该位置为起点的字符串的字典序在所有的字符串中中最小。暴力算法:O(n)的时间枚举起始位置,O(n)的时间比对字符串的字典序,总的时间复杂度是O(n^2)。线性算法:开始,i=0,j=1,k=0,其中i,j,k代表以i开头和以j开头的字符串的前k个字符相同只有三种情况1.如果str[i+k]==str[j+k] k++。2.如果str[i+k] &...

2018-04-16 22:18:54 341

原创 HDU 1876 A + B for you again(KMP)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1867Problem DescriptionGenerally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two s...

2018-04-15 19:13:21 242

原创 HDU 3336 Count the string

题目链接:http://hdu.hustoj.com/showproblem.php?pid=3336Problem DescriptionIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write ...

2018-04-15 17:36:22 141

原创 HDU 2594 Simpsons’ Hidden Talents

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2594 Problem DescriptionHomer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Ho...

2018-04-14 19:57:40 138

原创 和差化积公式

和差化积公式

2018-04-13 21:45:30 2468

原创 POJ 3080 Blue Jeans(暴力,KMP)

题目链接:http://poj.org/problem?id=3080DescriptionThe Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of cont...

2018-04-09 21:04:01 116

原创 E Youhane Assembler(“景驰科技杯”2018年华南理工大学程序设计竞赛)

题目链接:https://www.nowcoder.com/acm/contest/94/E题目大意:给定n个字符串,编号1-n,q次询问,每次询问一个了l,r,求r号字符串的前缀和l号的后缀匹配最大程度思路1:因为给定字符串只有ATCG四个字母,我们在r和l字符串中间加任意一个其他字符,通过KMP的Get_next即可求出,即Next[len]即为最后答案,因为中间添加了其他字符,所以l的后缀肯...

2018-04-08 21:11:16 299

原创 POJ 2752 Seek the Name, Seek the Fame(KMP的Next数组应用)

题目链接:http://poj.org/problem?id=2752DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. Th...

2018-04-08 20:38:46 116

原创 POJ 2406 Power Strings(KMP循环节问题)

题目链接:http://poj.org/problem?id=2406DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenati...

2018-04-08 17:53:51 210

原创 HDU 1358 Period (KMP的Next数组应用,循环节问题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1358Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to...

2018-04-08 17:23:35 247

原创 HDU 3746 Cyclic Nacklace(KMP求循环节)

题目链接:http://hdu.hustoj.com/showproblem.php?pid=3746Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there a...

2018-04-07 22:32:41 151

原创 HDU 2087 剪花布条

题目链接:http://hdu.hustoj.com/showproblem.php?pid=2087Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII...

2018-04-04 10:54:58 139

原创 HDU 1711 Number Sequence

题目链接: http://hdu.hustoj.com/showproblem.php?pid=1711Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <=...

2018-04-04 10:51:34 93

空空如也

空空如也

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

TA关注的人

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