#This script is to parse data file: fun0() { ##[INFO1]a=1 b=2 c=3[INFO2]a=7 b=8 c=9[INFO3]a=x b=y c=z } #! /bin/bashread Info Abc#echo $Infoif [ "$Inf ...
分类:
系统相关 时间:
2016-04-04 22:49:35
阅读次数:
264
#include "stdafx.h" #include <iostream> using namespace std; const int L = 7; int RecurMatrixChain(int i,int j,int **s,int *p);//递归求最优解 void Traceback ...
分类:
编程语言 时间:
2016-04-04 22:48:46
阅读次数:
295
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define maxn 1000003#define INF 100000000int dp[maxn],a[maxn],pre[maxn];int ...
分类:
其他好文 时间:
2016-04-04 22:48:17
阅读次数:
171
用queue模拟stack,因为queue只能取front的值,和stack正好相反,因此核心思想是queue保持着与stack相反的顺序,一直逆序,所以每次push进一个新值后,要依次把新值之前的值排到队尾。比如原来q为4、5,push进1,q依次为:4、5、1;5、1、4;1、4、5. 对应的s ...
分类:
其他好文 时间:
2016-04-04 21:00:17
阅读次数:
165
和225类似,queue和stack的性质正好相反,因此在push时要进行处理。 维护两个stack:stk和tmp,stk存放与queue相反的顺序,比如queue为:1、4、5,stk为:5、4、1,这样stk.top()会一直等于queue.front()。 每次push进一个数x时,先把st ...
分类:
其他好文 时间:
2016-04-04 20:55:45
阅读次数:
232
递归不要加inline 会出现神奇的错误。。。。。 1 #include <iostream> 2 #include <cstdio> 3 #define N 100010 4 using namespace std; 5 struct Tree 6 { 7 int size,rev,l,r; 8 ...
分类:
其他好文 时间:
2016-04-04 17:56:27
阅读次数:
211
题目:
有以ha为头结点的链表,元素个数为m;以hb为头结点的链表,元素个数为n。现在需要你把这两个链表连接起来,并使时间复杂度最小,请分析并实现。
思路:
很简单的链表操作的题目,逆序头部插入,并将长度较长的一方接到较短的后面,时间复杂度为O(min(m,n))。
#include
#include
#include
using namespace std;
typedef int...
分类:
其他好文 时间:
2016-04-04 16:39:50
阅读次数:
168
#include<iostream>#include<cstdlib>using namespace std;typedef int T;class SeqList{public: T *data; int q[100]; int n; int MaxSize; //顺序表最多可以存放的元素个数。 ...
分类:
其他好文 时间:
2016-04-04 16:32:17
阅读次数:
150
#include<iostream>#include<cstdlib>using namespace std;typedef int T;class SeqList{public: T *data; int q[100]; int n; int MaxSize; //顺序表最多可以存放的元素个数。 ...
分类:
其他好文 时间:
2016-04-04 16:29:55
阅读次数:
181
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1020 题目: Problem Description Given a string containing only 'A' - 'Z', we could encode it using the follo ...
分类:
其他好文 时间:
2016-04-04 14:36:12
阅读次数:
106