题意:
给定字符串,求字符串中的最长回文序列
解题思路:
manacher 算法
时间复杂度:O(N)
代码:
#include
#include
#include
#define MAXN 110010
using namespace std;
char b[MAXN],a[MAXN<<1];
int p[MA...
分类:
编程语言 时间:
2015-08-02 06:26:31
阅读次数:
146
/*
两个字符串A、B。从A中剔除存在于B中的字符。
比如A = “hello world”, B = "er",那么剔
除之后A变为"hllo wold"。空间复杂度要求是O(1)
,时间复杂度越优越好。
*/
#include
#include
using namespace std;
void Grial(char *str,char *ptr)
{...
分类:
编程语言 时间:
2015-08-02 06:24:28
阅读次数:
127
A combination of different DP passes.https://www.hackerrank.com/challenges/lego-blocks/editorial#include #include #include using namespace std;typedef...
分类:
其他好文 时间:
2015-08-02 06:23:17
阅读次数:
187
1.如果有向图无回路,那么该图拓扑有序。
2代码:
#include
#include
using namespace std;
int mat[505][505];
int n,m;
int in[505];
void topological_sort()
{
int cnt=n;
while(cnt--)
{
int i;
for...
分类:
其他好文 时间:
2015-08-02 01:06:26
阅读次数:
125
本文以USB转串口为例!PC自带的串口从ttyS0起(ttyS0-COM1、ttyS1-COM2以此类推)。
一、查找串口设备
dmesg | grep usb
我们会看到PL2303映射在ttyUSB0端口上。
[ 1.797793] usb 2-1.6: new full-speed USB device number 4 using ehci-pci
[ 1.89...
分类:
系统相关 时间:
2015-08-02 01:04:28
阅读次数:
245
最短路径
在无向图 G=(V,E) 中,假设每条边 E[i] 的长度为 w[i],找到由顶点 V0 到其余各点的最短值。
#include "stdafx.h"
#include
#include
using namespace std;
#define N 9
#define MIN 1000000
typedef struct{
int vexnum, arcnum;
char ...
分类:
其他好文 时间:
2015-08-02 01:02:03
阅读次数:
101
水~#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAX(x,y) (((x)>(y))?(x):(y))
#define MIN(x,y)...
分类:
其他好文 时间:
2015-08-02 01:00:24
阅读次数:
188
算法可以参考http://wenku.baidu.com/view/8e9ebefb0242a8956bece4b3.html百度文库#include #include using namespace std; const int MM=100005; int next[MM],extand...
分类:
其他好文 时间:
2015-08-02 00:57:09
阅读次数:
222
using System;using System.Data;using System.Configuration;using System.Text;/// /// Summary description for ConvertHzToPz_Gb2312 /// public class Co.....
分类:
其他好文 时间:
2015-08-02 00:54:51
阅读次数:
340
这题说的是给了三维空间然后操作 寻求在 x1,y1,z1 x2, y2, z2; (x1#include #include #include using namespace std;const int maxn=50005;struct point{ int x,y,z,delt,qnum,k...
分类:
其他好文 时间:
2015-08-02 00:50:18
阅读次数:
188