上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 66 下一页
摘要: Flow ProblemTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1252Accepted Submission(s): 606Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted direc 阅读全文
posted @ 2011-08-08 10:40 沐阳 阅读(2408) 评论(0) 推荐(1) 编辑
摘要: World ExhibitionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 568Accepted Submission(s): 264Problem DescriptionNowadays, many people want to go to Shanghai to visit the World Exhibition. So there are always a lot of people who are standing along 阅读全文
posted @ 2011-08-06 16:48 沐阳 阅读(377) 评论(0) 推荐(0) 编辑
摘要: Burn the Linked CampTime Limit: 1 Second Memory Limit: 32768 KBIt is well known that, in the period of The Three Empires, Liu Bei, the emperor of the Shu Empire, was defeated by Lu Xun, a general of the Wu Empire. The defeat was due to Liu Bei's wrong decision that he divided his large troops in 阅读全文
posted @ 2011-08-05 19:23 沐阳 阅读(708) 评论(0) 推荐(0) 编辑
摘要: 作为最短路的其他几种解法,是很有必要掌握的,已知的Dijkstra只能够解决不存在负权边的图形(其灵魂是在确定点的时候同时预言了其后面一定是大于零的边),而 Floyed 算法的时间复杂度决定了其使用的范围。所以在遇到负权边的时候就要用到Bellman-Ford或者是SPFA了,可以说其是对于 Dijkstra 算法的一个简化,没有了寻找最小路径长度点然后加入集合的过程。Bellman每次都暴力搜索所有顶点,直到没有点再被更新为止,SPFA遇到更新的点就加入队列,直到队列为空为止,当然也可以使用栈。 这是写的两个简单的程序:// Bellman-Ford#include <cstdio& 阅读全文
posted @ 2011-08-05 15:39 沐阳 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 题目给定一个非常巨大的串,然后给定许多模式串去匹配,如果是用KMP的话那么母串会被扫描很多次,这样便会超时。 AC自动机,一种对于多串匹配的优化,其原理很想KMP,只不过,在KMP算法中,next值只在于与自身的前缀进行匹配,而这里则将next的范围扩展到其他串的前缀,很NB的想法啊。哦,对了,其与KMP的区别还有一些地方,每次匹配一个字符时都搜索到根节点,看在这途中是否存在一个完整的单词。时间有限,不详写了。 代码如下:#include <stdio.h>#include <string.h>#include <math.h>#include <qu 阅读全文
posted @ 2011-08-04 12:05 沐阳 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 题目是给定一个数字串,求出这些数字串中哪些出现的次数是奇数次,所以运用按位异或就能够直接将出现偶数次的数字抵消掉。不加输入外挂G++ 500MS+加了之后62MS 代码如下:#include <stdio.h>void getint( int &c ){ char chr; while( chr= getchar(), chr< '0'|| chr> '9' ) ; c= chr- '0'; while( chr= getchar(), chr>= '0'&& chr<= 阅读全文
posted @ 2011-08-03 19:53 沐阳 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 1567: 折纸Time Limit: 1 SecMemory Limit: 128 MBSubmit: 10Solved: 3[Submit][Status][Web Board]Description小熊vee很喜欢玩折纸,所以经常把她哥哥的作业本撕下来折纸,今天vee纸张的时候突然想到了一个问题,给你一张格子张纸(.... 就是小学时写作业用的小字本一样的格子)共有n行,m列,然后规定你有四种折的方法,top flip,bottom flip,left flip,right flip。top flip: 是将最上面的第一行翻折,并与第二行重叠,在第二行之上。(于是折之前的第二行将变为第一 阅读全文
posted @ 2011-08-03 18:44 沐阳 阅读(296) 评论(0) 推荐(0) 编辑
摘要: 1558: Count CyclesTime Limit: 1 SecMemory Limit: 128 MBSubmit: 84Solved: 21[Submit][Status][Web Board]DescriptionIn information theory, a low-density parity-check (LDPC) code is a linear error correcting code, a method of transmitting a message over a noisy transmission channel, and is constructed u 阅读全文
posted @ 2011-08-02 19:22 沐阳 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 1560: The Least Palindromic NumberTime Limit: 1 SecMemory Limit: 128 MBSubmit: 111Solved: 15[Submit][Status][Web Board]Description Palindromic numbers are digital strings that read the same both forwards and backwards. For example, 121, 44 and 3 are Palindromic numbers, 175, 36 are not;For a given i 阅读全文
posted @ 2011-08-02 19:08 沐阳 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 1102: 月份牌Time Limit: 1 SecMemory Limit: 128 MBSubmit: 48Solved: 2[Submit][Status][Web Board]Description这里有一份2011年的月份牌可以参考 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 2 3 4 5 1 2 3 4 5 2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12 9 10 11 12 13 14 15 13 阅读全文
posted @ 2011-08-02 10:28 沐阳 阅读(360) 评论(0) 推荐(0) 编辑
上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 66 下一页