题目:Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter...
分类:
编程语言 时间:
2014-08-06 01:35:30
阅读次数:
389
HDU 4911 Inversion
题意:n个数字 通过k次相邻交换 使得逆序对数最少
思路:如果序列为 XXXABYYY 假设A和B位置互换 易知X和AB、Y和AB的逆序对数不变 换句话说一次交换最多使逆序对减少1 那么只需要求原逆序对数和k进行比较即可
HDU 4915 Parenthese sequence
题意:?可以代表(或) 那么输入的字符串能构造出几种合法的括号序列呢 输出无解、唯一解、多解
思路:这题是我YY的… 首先我们可以计算出(和)应该填几个 如果计算出?不满足我...
分类:
其他好文 时间:
2014-08-05 22:48:20
阅读次数:
289
Problem Description
bobo has a sequence a1,a2,…,an. He is allowed to swap two
adjacent numbers for no more than k times.
Find the minimum number of inversions after his swaps.
Note: The number...
分类:
其他好文 时间:
2014-08-05 22:44:03
阅读次数:
248
KMP查找整数数列,不是查找字符串。
原理是一样的,不过把字符串转换为数列,其他基本上是一样的。
#include
#include
const int MAX_N = 1000001;
const int MAX_M = 10001;
int strN[MAX_N], strM[MAX_M], next[MAX_M], N, M;
void getNext()
{
mems...
分类:
其他好文 时间:
2014-08-05 22:37:10
阅读次数:
194
hdu4915Parenthese sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 82 Accepted Submissi...
分类:
其他好文 时间:
2014-08-05 22:09:00
阅读次数:
673
呵呵不是我做的
#include
#include
#include
const int N = 1000000 + 10;
char s[N];
int d[N], num[N];
int main() {
while (~scanf("%s", s)) {
memset(num, 0, sizeof num);
int len = strlen...
分类:
其他好文 时间:
2014-08-05 19:25:10
阅读次数:
218
Parenthese sequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 50 Accepted Submission(s): 11
Problem Description
bobo fou...
分类:
其他好文 时间:
2014-08-05 19:19:30
阅读次数:
232
题意:用最少的括号将给定的字符串匹配,输出最优解。可能有空行。思路:dp。dp[i][j]表示将区间i,j之间的字符串匹配需要的最少括号数,那么如果区间左边是(或[,表示可以和右边的字符串匹配,枚举中间断点k,如果str[i]==str[k]则dp[i][j]=min(dp[i][j],dp[i+1...
分类:
其他好文 时间:
2014-08-05 13:46:00
阅读次数:
270
BestCoder Sequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 711 Accepted Submission(s): 253
Problem Description
Mr Potato...
分类:
其他好文 时间:
2014-08-05 11:22:52
阅读次数:
231
题目地址:POJ 2442
真心没想到这题的思路。。原来是从第一行逐步向下加,每次都只保存前n小的数。顺便练习了下堆。。不过感觉堆的这种用法用的不太多啊。。
又是手残。。把j写成了i,于是就改啊改。。改的跟题解上的几乎一样了= = !。。
代码如下:
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-08-05 11:09:19
阅读次数:
186