题目链接:http://poj.org/problem?id=2229 思路:“动态规划”问题 只需要列三个连续数字N即可发现:1.N为奇数时,f(n)=f(n-1) 2.N为偶数时,f(n)=f(n-1)+f(n/2) 因为此时N-1为基数,N-1情况的每一行第一个数一定是1,所以加上一个1时,就 ...
分类:
其他好文 时间:
2020-03-29 10:26:48
阅读次数:
53
1.POJ 1328 Radar Installation 题意:给出一定数量的岛屿和雷达的观测范围d,问在海岸线最少建设多少个雷达就能覆盖完所有的岛屿。 题目分析: 要想使雷达最少,每个雷达就要尽可能多的覆盖岛屿。我最开始的思路一直是从最左边未被覆盖的岛屿的x坐标开始, 在[x,x+sqrt(d^ ...
分类:
其他好文 时间:
2020-03-28 23:30:52
阅读次数:
82
题目链接:http://poj.org/problem?id=3352 题目要求求出无向图中最少需要多少边能够使得该图边双连通。 在图G中,如果任意两个点之间有两条边不重复的路径,称为“边双连通”,去掉任何一条边都是其他边仍然是连通的,也就是说边双连通图中没有割边。 算法设计是:运用tarjan+缩 ...
分类:
其他好文 时间:
2020-03-28 01:03:30
阅读次数:
89
ACM has bought a new crane (crane -- je?áb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th s ...
分类:
其他好文 时间:
2020-03-26 16:36:32
阅读次数:
93
A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker c ...
分类:
其他好文 时间:
2020-03-25 01:13:56
阅读次数:
53
题目链接:http://icpc.njust.edu.cn/Problem/Pku/1182/ 题意:给出动物之间的关系,有几种询问方式,问是真话还是假话。 定义三种偏移关系: x->y 偏移量0时 x和y同类 x->y 偏移量1时 x被y吃 x->y 偏移量2时 x吃y 定义 rela[x]=rx ...
分类:
其他好文 时间:
2020-03-25 01:06:48
阅读次数:
66
题目描述 The cows are being invaded! Their republic comprises N (1 <= N <= 50,000) towns that are connected by M (1 <= M <= 100,000) undirected paths betw ...
分类:
其他好文 时间:
2020-03-24 09:16:45
阅读次数:
78
相信大家都已经会求最短路了,k短路是在最短路熟练掌握的情况下进行的一个进阶,要求把最短路的过程想的十分通透才能学的懂。 先摆出一道例题做引例: http://poj.org/problem?id=2449 POJ2449 Remmarguts' Date 大概题意就是求从s到t的第k短路,注意要反着 ...
分类:
其他好文 时间:
2020-03-23 17:21:09
阅读次数:
83
题目链接:http://poj.org/problem?id=1328 思路:贪心 一开始的思路: 1. 以第一个岛屿为圆心,d为半径画圆,记与x轴的焦点中较大的那个为第一个雷达的位置; 2. 以这个雷达位置为圆心,d为半径画圆,记下之后的岛屿中第一个不能被覆盖的; 3. 依次这样下去,直到不能找到 ...
分类:
其他好文 时间:
2020-03-23 15:22:04
阅读次数:
70
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which the ...
分类:
其他好文 时间:
2020-03-23 13:47:05
阅读次数:
74