上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页
小希的迷宫Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两种方法从5到达8。Input输入包含多组数据,每组数据是一个以0 0结 Read More
posted @ 2013-04-07 20:58 free斩 Views(179) Comments(0) Diggs(0) Edit
POJ 1308hdu 1325Is It A Tree?Time Limit:1000MSMemory Limit:10000KTotal Submissions:17384Accepted:5956DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following propert Read More
posted @ 2013-04-07 20:05 free斩 Views(214) Comments(0) Diggs(0) Edit
食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:33805Accepted:9820Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句 Read More
posted @ 2013-04-07 14:18 free斩 Views(193) Comments(0) Diggs(0) Edit
Ubiquitous ReligionsTime Limit:5000MSMemory Limit:65536KTotal Submissions:19292Accepted:9472DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university b Read More
posted @ 2013-04-06 22:03 free斩 Views(135) Comments(0) Diggs(0) Edit
The SuspectsTime Limit:1000MSMemory Limit:20000KTotal Submissions:17149Accepted:8272DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separa Read More
posted @ 2013-04-06 21:49 free斩 Views(163) Comments(0) Diggs(0) Edit
搜索专题(Newer)题解:A bfs依次遍历周围的八个方向(马走日)B bfs注意记录当前方向和转弯数C bfs入门题目,注意要清空队列D dfs入门,周围加边四个方向深搜即可。E dfs.八连块问题 只要周围的八个方向的图是一样的,则都算是同一个八连块,记录共有多少个八连块即可。D dfs 深度遍历每一条路即可,只是要边遍历边记录路径,最后输出路径就好了E dfs+奇偶剪枝优化IDTitle13/19Problem AKnight Moves6/38Problem B逃离迷宫8/40Problem CCatch That Cow8/8Prob... Read More
posted @ 2013-03-30 21:55 free斩 Views(188) Comments(0) Diggs(0) Edit
训练赛(Older)#001题解(F):1不知道 二维多重背包。。。2多重背包模板题3完全背包模板题4线段树求区间最值 模板题5幂取模乱搞6DFS7水题8水题IDOriginTitle2/14Problem AHDU 3496Watch The Movie10/23Problem BHDU 2191悼念512汶川大地震遇难同胞――珍惜现在,感恩生活8/11Problem CHDU 4508湫湫系列故事――减肥记I5/9Problem DPOJ 3264Balanced Lineup6/22Problem EHDU 4506小明系列故事――师兄帮帮忙4/5... Read More
posted @ 2013-03-26 16:04 free斩 Views(229) Comments(0) Diggs(0) Edit
转载来自:http://lynclass.blog.sohu.com/84582061.html匹配中文字符的正则表达式: [\u4e00-\u9fa5], [\一-\龥]可以.评注:匹配中文还真是个头疼的事,有了这个表达式就好办了匹配双字节字符(包括汉字在内):[^\x00-\xff]评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)匹配空白行的正则表达式:\n\s*\r评注:可以用来删除空白行匹配HTML标记的正则表达式:]*>.*?|评注:网上流传的版本太糟糕,上面这个也仅仅能匹配部分,对于复杂的嵌套标记依旧无能为力匹配首尾空白字符的正则表达式:^\s*| Read More
posted @ 2013-03-25 16:33 free斩 Views(127) Comments(0) Diggs(0) Edit
Balanced LineupTime Limit:5000MSMemory Limit:65536KTotal Submissions:26435Accepted:12401Case Time Limit:2000MSDescriptionFor the daily milking, Farmer John'sNcows (1 ≤N≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the Read More
posted @ 2013-03-24 20:34 free斩 Views(162) Comments(0) Diggs(0) Edit
下面的源代码是修改的了时间差精确到了纳秒级别的了,但是还是感觉很有误差。无论怎么测,总是快排比归并快,即使是测试数据的数组长度在10以内。 前面一样的程序写的是时间精确到微秒级的,数组长度大概在一万以内的,就是归并排序快了,大于这个长度的快速排序比较快。综合上面的情况,数组小时,二者时间差也不会太多,所以个人认为还是快速排序比较好了,唉还是觉得归并比较简单好写,弱爆了啊。。。#include<cstdio>#include<Windows.h>#include<ctime>#include<cstdlib>#include<cstring& Read More
posted @ 2013-03-21 10:51 free斩 Views(1516) Comments(0) Diggs(0) Edit
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页