给出来的数据量还是可以的。题意:有若干个牧场,至少有两个不连通,一个牧场的直径就是牧场中最远的两个牧区的距离。要求找出几个牧场中最短的直径,就是找一条路径连接几个牧区,使这个直径最终最小。
基本方法,把整个图根据输入划分成几个不连通的牧区,然后求出每个牧区的直径(即每个连通块中的最长路径),然后枚举两个不在同一牧区的点,设blocks[i]记录第i个节点所在连通块的直径,那么result = m...
分类:
其他好文 时间:
2014-07-18 11:04:46
阅读次数:
287
深入浅出之正则表达式(二)前言:本文是前一片文章《深入浅出之正则表达式(一)》的续篇,在本文中讲述了正则表达式中的组与向后引用,先前向后查看,条件测试,单词边界,选择符等表达式及例子,并分析了正则引擎在执行匹配时的内部机理。 本文是Jan Goyvaerts为RegexBuddy写的教程的译文,版....
分类:
Web程序 时间:
2014-07-17 21:30:07
阅读次数:
575
Description
Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to retire by the end of the year. The Goldmine management would like to reward him in acknowledgment...
分类:
其他好文 时间:
2014-07-17 10:24:12
阅读次数:
307
Fence LoopsThe fences that surround Farmer Brown's collection of pastures have gotten out of control. They are made up of straight segments from 1 thr...
分类:
其他好文 时间:
2014-07-16 19:06:02
阅读次数:
516
Fence RailsBurch, Kolstad, and SchrijversFarmer John is trying to erect a fence around part of his field. He has decided on the shape of the fence and...
分类:
其他好文 时间:
2014-07-16 00:08:30
阅读次数:
367
H - Gold Coins(2.4.1)
Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
The king pays his loyal knight in gold coins. On the first ...
分类:
其他好文 时间:
2014-07-15 13:14:28
阅读次数:
275
Gold Coins
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 20913
Accepted: 13098
Description
The king pays his loyal knight in gold coins. On the first day o...
分类:
其他好文 时间:
2014-07-13 20:45:45
阅读次数:
205
USER: Kevin Samuel [kevin_s1]
TASK: comehome
LANG: C++
Compiling...
Compile: OK
Executing...
Test 1: TEST OK [0.003 secs, 3376 KB]
Test 2: TEST OK [0.005 secs, 3376 KB]
Test 3: TEST OK [0.0...
分类:
其他好文 时间:
2014-07-12 19:26:53
阅读次数:
184
题目链接:http://poj.org/problem?id=2000题目大意:求N天得到多少个金币,第一天得到1个,第二、三天得到2个,第四、五、六天得到3个、、、、以此类推,得到第N天的金币数。 1 #include 2 #include 3 #include 4 using namesp...
分类:
其他好文 时间:
2014-07-12 08:51:24
阅读次数:
176
一块N x N(1
1:转90度:图案按顺时针转90度。
2:转180度:图案按顺时针转180度。
3:转270度:图案按顺时针转270度。
4:反射:图案在水平方向翻转(以中央铅垂线为中心形成原图案的镜像)。
5:组合:图案在水平方向翻转,然后再按照1到3之间的一种再次转换。
6:不改变:原图案不改变。
7:无效转换:无法用以上方法得到新图案。...
分类:
其他好文 时间:
2014-07-08 14:33:24
阅读次数:
161