自定义博客皮肤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)
  • 收藏
  • 关注

原创 二分图的匹配算法小结

无权二分图的匹配与匈牙利算法二分图:简单来说就是图中的点可以分成两部分,并且每一部分里面都没有边相连,任意一条边起点和终点都不在同一个点集。匹配:边的集合,任意两条边都没有公共点。匹配点,匹配边:在匹配中的点和边非匹配点,非匹配边:不在匹配集合中的点和边。最大匹配:图的所有匹配中,含边数最多的匹配就是最大匹配。完美匹配:匹配集合中涵盖了所有的点,所有的点都是匹配点。显然,完

2016-03-21 20:24:12 645

原创 Sicily 1049 Mondriaan

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One day, while working on his latest project, he was in

2016-03-21 16:25:52 306

原创 Sicily 1345 能量项链

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description在Mars星球上,每个Mars人都随身佩带着一串能量项链。在项链上有N颗能量珠。能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数。并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记。因为只有这样,通过吸盘(吸盘是Mars人吸收能

2016-03-21 16:11:19 795

原创 Sicily 1045 Space Management

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionThe new general manager Gill Bates has been to a seminar on time management. Ever since she has been bothering all of her staff to

2016-03-21 15:57:24 268

原创 Sicily 1099 Packing Passengers

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionPTA, Pack ‘em Tight Airlines is attempting the seemingly impossible—to fly with only full planes and still make a profit. Their st

2016-03-16 13:39:41 283

原创 Sicily 1140 国王的遗产

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description哈丁国的国王一生善于管理,勤于政务,在国家里聚积了大量的财富。但他众多的孩子都不争气,相互间时常勾心斗角,却没有一个真正能接受国王传位的人。为了避免将来某儿子一人独揽大权,又出于不能让权力过度分散的考虑,临终前,国王作了一个决定:国王他将一生的财富打造出了一条

2016-03-16 13:28:34 1522

原创 Sicily 1148 过河

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧。在桥上有一些石子,青蛙很讨厌踩在这些石子上。由于桥的长度和青蛙一次跳过的距离都是正整数,我们可以把独木桥上青蛙可能到达的点看成数轴上的一串整点:0,1,……,L(其中L是桥的长度)。坐标为0的点表示

2016-03-12 18:22:54 1183

原创 Sicily 1047 Super Snooker

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionOn one of my many interplanetary travels I landed on a beautiful little planet called Crucible. It was inhabited by an extremely p

2016-03-11 22:07:33 326

原创 Sicily 1013 Going Home

ConstraintsTime Limit: 10 secs, Memory Limit: 32 MB Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontal

2016-03-11 19:41:51 384

原创 Sicily 1488 矩阵取数游戏

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description帅帅经常跟同学玩一个矩阵取数游戏:对于一个给定的n*m的矩阵,矩阵中的每个元素aij均为非负整数。游戏规则如下:1.    每次取数时须从每行各取走一个元素,共n个。m次后取完矩阵所有元素;2.    每次取走的各个元素只能是该元素所在行的行首或行尾;

2016-03-09 17:32:18 303

原创 Sicily 1005 Roll Playing Games

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionPhil Kropotnik is a game maker, and one common problem he runs into is determining the set of dice to use in a game. In many curre

2016-03-08 16:48:04 485

原创 Sicily 1008 Translations

DescriptionBob Roberts is in charge of performing translations of documents between various languages. To aidhim in this endeavor his bosses have provided him with translation files. These files com

2016-03-07 20:51:59 469

原创 Sicily 1327 Pinary

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description``Pinary" number is a positive number using only two digits ``0" and ``1" with usual rule that it must not begin with a 0, and the

2015-03-10 14:40:48 334

原创 Sicily 2013 Pay Back

ConstraintsTime Limit: 1 secs, Memory Limit: 256 MB Description"Never a borrower nor a lender be." O how Bessie wishes she had taken that advice! She has borrowed from or lent money to each of

2015-02-26 14:07:20 522

原创 HDU 2585 Hotel

Problem DescriptionLast year summer Max traveled to California for his vacation. He had a great time there: took many photos, visited famous universities, enjoyed beautiful beaches and tasted variou

2015-02-25 21:42:29 760

原创 Sicily 1221 数字游戏

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description小W发明了一个游戏,他在黑板上写出了一行数字a1,a2,….an,然后给你m个回合的机会,每回合你可以从中选择一个数擦去它,接着剩下来的每个数字ai都要递减一个值bi。如此重复m个回合,所有你擦去的数字之和就是你所得到的分数。  小W和他的好朋友小

2015-02-25 18:44:49 1185

原创 POJ 2479 Maximum sum && sicily 1090

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:                                 t1     t2

2015-02-25 17:03:56 272

原创 Sicily 1153 马的周游问题[Special judge] && sicily 1152

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB , Special Judge Description和题目C同样的任务,这里只是把棋盘扩大到标准的国际象棋。对这样一个8 * 8的棋盘用同样的方法编号如下:1     2     3       4     5     6       7     89     10   

2015-02-25 14:06:40 361

原创 Sicily 1077 Cash Machine && POJ 1276

ConstraintsTime Limit: 10 secs, Memory Limit: 32 MB DescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate bills for a requested cash amou

2015-02-24 13:15:12 368

原创 UVALive 4244 Party Party Party(HDU 2779 && Sicily 1663)

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionEmma has just graduated high school and it is the custom for the new graduates to throw parties for themselves and invite everyone

2015-02-23 20:41:03 514

原创 Sicily 1305 Who’s Winner?

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionNic and Susan play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Nic always starts with p=1

2015-02-22 15:37:24 338

原创 Sicily 1158 Pick numbers

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionGiven a matrix of size M*N, the elements of which are integer numbers from -10 to 10. You task is to go from the top-left corner (

2015-02-17 21:56:58 287

原创 我对于KMP算法的一点理解

KMP算法是很巧妙的,代码又短,它涉及到了我所学到的状态转移的东西,我用这个来理解KMP,效果是比较好的。首先说一下状态转移,用我的话来说就是转跳,从一个值转跳到另一个值,比如说匹配了3个字符,然后转跳到了匹配了1个字符(注意,这个就是KMP的一个简单描述,后面会详细阐述),从3到1。另外还会涉及到前缀和后缀,简单的理解就是字符串的前面和后面。比如说字符串s="abcdefghi",前

2015-02-17 19:53:16 394

原创 Sicily 1282 Computer Game

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionBrian is an enthusiast of computer games, especially those that simulate virtual reality. Now he is in front of the Star Gate. In

2015-02-17 19:44:32 403

原创 Sicily 1193 Up the Stairs

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionJohn is moving to the penthouse of a tall sky-scraper. He packed all his stuff in boxes and drove them to the entrance of the bu

2015-02-16 17:04:25 613

原创 UVa 202 Repeating Decimals

DescriptionThe decimal expansion of the fraction 1/33 is , where the is used to indicate that the cycle 03 repeats indefinitely with no intervening digits. In fact, the decimal expansion of every

2015-02-15 17:18:44 337

转载 康托展开和逆康托展开

康托展开  康托展开的公式是 X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0! 其中,ai为当前未出现的元素中是排在第几个(从0开始)。  这个公式可能看着让人头大,最好举个例子来说明一下。      例如,有一个数组 s = ["A", "B", "C", "D"],它的一个排列 s1 = ["D", "B", "A"

2015-02-14 16:59:19 310

原创 Sicily 1006 Team Rankings

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionIt's preseason and the local newspaper wants to publish a preseason ranking of the teams in the local amateur basketball league. T

2015-02-14 16:51:14 315

原创 Sicily 1022 Poor contestant Prob

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionAs everybody known, “BG meeting” is very very popular in the ACM training team of ZSU.After each online contest, they will go

2015-02-14 15:17:56 590

原创 Sicily 1209 Sequence Sum Possibi

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionMost positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance,6 = 1

2015-02-13 20:18:37 336

原创 Sicily 1210 二叉树

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB Description在众多的数据结构中,二叉树是一种特殊而重要的结构,有着广泛的应用。二叉树或者是一个结点,或者有且仅有一个结点为二叉树的根,其余结点被分成两个互不相交的子集,一个作为左子集,另一个作为右子集,每个子集又是一个二叉树。遍历一棵二叉树就是按某条搜索路径巡访其中每

2015-02-13 18:46:52 1628 1

原创 Sicily 1166 Computer Transformat

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionA sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the computer

2015-02-13 17:07:48 293

原创 Sicily 1176 Two Ends

ConstraintsTime Limit: 1 secs, Memory Limit: 64 MB DescriptionIn the two-player game "Two Ends", an even number of cards is laid out in a row. On each card, face up, is written a positive inte

2015-02-13 14:58:42 288

原创 Sicily 2011 Nine Digits

ConstraintsTime Limit: 2 secs, Memory Limit: 256 MB Description Nine tiles, each with a number from 1 to 9 on it, are packed into a 3 by 3 frame. Your task is to arrange the tiles so that they a

2015-02-08 19:28:33 376

原创 Sicily 1750 运动会

ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionZEH是一名04级的学生,他除了绩点高,还有运动细胞。有一次学院举办运动会,ZEH发现里面的项目都是他所向披靡的,当然他想获得所有项目的No1,但是一个人的精力总是有限的,ZEH也是只有P(Power的简写,一个大于0且小于1000的整数)的精力。如果精力足够

2015-02-08 17:52:21 836

原创 Sicily 1031 Campus

大意就是求出两个地点的最短路。简单的单源最短路问题,我用的是优先队列实现的dijkstra算法,离散数学教的~注意题目的陷阱,输入数据的坑就好啦。#include #include #include #include #define MAXN 205#define INF 100000000using namespace std;int d[MAXN];

2015-02-07 17:22:16 341

原创 Sicily 2010 H Number

大意是要找出符合规律的数字,数据量不大,穷举即可。#include#includebool hNumber(int n);int main(){ int i,n,count=0; scanf("%d",&n); for (i = 1; i <= n; i++) if (hNumber(i)) count++; printf("%d\n",count); r

2015-02-05 22:33:08 255

原创 Sicily 1935 二叉树重建

数据结构的简单题,对帮助理解二叉树的遍历蛮有帮助的。#include #include using namespace std;struct node{ char val; node * left; node * right;};node * build(int n, char * pre, char * in){ //注意strchr返回的是指向那个

2015-02-04 23:45:42 245

原创 Sicily 6084 Times17

简单的二进制乘法计算,注意到二进制中有位移的存在,那么乘以17可以变成乘以(16+1),16=2^4,那么左移四位加上原来的数字就是答案啦~#include #include using namespace std;char s[1015];int ans[1018];int main(){ int i, j, len; cin >> s;

2015-02-03 20:01:41 365

原创 Sicily 1137 河床

数据比较小,直接暴力枚举就ok啦。#include using namespace std;int d[30005];int main(){ int i, j, n, k, max, min, maxlen = 0; cin >> n >> k; for (i = 0; i > d[i]; for (i = 0; i <

2015-02-03 16:17:43 298

空空如也

空空如也

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

TA关注的人

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