AC自动机UVa 11468 SubstringAC自动机+概率DP。注意要补全不存在的边。为什么要补全不存在的边呢?补全以后可以直接找到状态的转移,即从所有子节点就可以实现所有状态转移。#include#include#include#include#include#include#include...
分类:
其他好文 时间:
2014-08-18 21:59:23
阅读次数:
337
这是一个最短路径的裸题,我们在边结构体中 添加成员路径和花费,然后在松弛操作的时候用这两个来松弛就OK
// AC 840k 109ms
#include
#include
using namespace std;
#define MAX 1001
#define IFN 1<<30-1
struct node
{
int to,len,cost,next;
}edge[MAX*100...
分类:
其他好文 时间:
2014-08-18 20:33:12
阅读次数:
155
package com.lw.leet4;/** * @ClassName:Solution * @Description: * Sort List * Sort a linked list in O(n log n) time using constant spa...
分类:
其他好文 时间:
2014-08-18 20:26:22
阅读次数:
170
缩写原意: Overflow of = OV NV [No Overflow] Direction df = DN (decrement) UP (increment) Interrupt if = EI (enabled) DI (disabled) Sign sf = NG (negative)...
分类:
编程语言 时间:
2014-08-18 18:06:32
阅读次数:
417
前天wildcard matching没AC,今天接着搞,改用动态规划。题目再放一次:'?'匹配任意字符,'*'匹配任意长度字符串Some examples:isMatch("aa","a") → falseisMatch("aa","aa") → trueisMatch("aaa","aa") →...
分类:
其他好文 时间:
2014-08-18 00:06:43
阅读次数:
283
水题一道- -暴力做法、打表都可以0ms AC。时间:0毫秒。#include#includeusing namespace std;int main(){ double ans=1, temp=1; int i=0; cout<<"n e"<<endl; cout<<...
分类:
其他好文 时间:
2014-08-17 21:11:22
阅读次数:
189