Given a string S, find the longest palindromic
substring in S. You may assume that the maximum length of S is 1000, and there
exists one unique longes...
分类:
其他好文 时间:
2014-05-16 21:15:37
阅读次数:
454
题意:给一个图,有些点之间已经连边,现在给每对点之间加边的概率是相同的,问使得整个图连通,加边条数的期望是多少。此题可以用概率DP+并查集+hash来做。用dp(i,j,k...)表示当前的每个联通分量的点数分别是i,j,k...(连通分量的个数不固定)时,加边的期望。这样以dp(i,j,k)为例分...
分类:
其他好文 时间:
2014-05-16 06:23:26
阅读次数:
312
问题描述
最长递增子序列也称 “最长上升子序列”,简称LIS ( longest increasing subsequence)。设L=是n个不同的实数的序列,L的递增子序列是这样一个子序列Lis=,其中k1
如:求一个一维数组arr[i]中的最长递增子序列的长度,如在序列{ 7, 1, 6, 5, 3, 4, 8 }中,最长递增子序列长度为4,其递增子序列为:1,3,4,8。...
分类:
其他好文 时间:
2014-05-15 15:06:59
阅读次数:
328
【题目】
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the len...
分类:
其他好文 时间:
2014-05-15 14:40:14
阅读次数:
320
题目链接:http://poj.org/problem?id=2135
Farm Tour
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10862
Accepted: 4024
Description
When FJ's f...
分类:
其他好文 时间:
2014-05-15 11:24:14
阅读次数:
348
题目链接:http://poj.org/problem?id=3469
Dual Core CPU
Time Limit: 15000MS
Memory Limit: 131072K
Total Submissions: 18147
Accepted: 7833
Case Time Limit: 5000MS
...
分类:
其他好文 时间:
2014-05-15 06:23:05
阅读次数:
271
给你两个四位的素数s和t,要求每次改变一个数字,使得改变后的数字也为素数,求s变化到t的最少变化次数。...
分类:
其他好文 时间:
2014-05-15 05:38:25
阅读次数:
234
【题目】
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
【题意】
题意是找出字符串S中最长回文子串,S最长为1000,保证有唯一解
【思路】
原字符串用特殊字符#间隔,如下所示:
#a...
分类:
其他好文 时间:
2014-05-15 03:31:25
阅读次数:
299
题目连接:http://poj.org/problem?id=1436
题意:给一些线段,每个线段有三个值y1, y2, x代表起点为(x, y1),终点为(x, y2)的线段。当从一个线段可以作水平线到另一个线段并且不穿过其他线段时,就称这两个线段时水平可见的。当三个线段可以两两水平可见,就称为形成一个线段三角。问:在这些线段中有多少个这样的线段三角?
分析:可以把每条线段看做是一个点,如果...
分类:
其他好文 时间:
2014-05-14 15:27:25
阅读次数:
282
CoinsTime Limit:3000MSMemory Limit:30000KTotal
Submissions:27580Accepted:9335DescriptionPeople in Silverland use coins.They
have coins of value A1,A2,...
分类:
其他好文 时间:
2014-05-14 11:52:46
阅读次数:
270