上一页 1 2 3 4 5 6 7 8 9 ··· 17 下一页

2011年11月10日

一种基于自动机的快速分词方法

摘要: 分词是自然语言处理入门的第一步,我参照导师的论文和写了一个基于自动机的快速分词方法;其主要内容是字典的构建,字典的结构能够决定分词的效率;本系统分词的实现,第一个字的查找采用的是hash,分词的时间复杂度为O(1);第二个字的查找是用二分查找实现的,时间复杂度为1+log2(n);其余部分采用的是顺序查找,整体的时间复杂度跟词的长度有关。实现的框架如下:const int START1 = 0XB0, START2 = 0XA1, END1 = 0XF8, END2 = 0XFF; //不用说,这个对于自然语言处理的人都知道是什么意思;const int MAXWORDLEN = 48; .. 阅读全文

posted @ 2011-11-10 20:02 _Clarence 阅读(236) 评论(0) 推荐(0) 编辑

2011年9月22日

ZOJ 2412 Farm Irrigation

摘要: 题目描述:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1412#include <iostream>#include <cstring>#include <cstdio>using namespace std;const int maxn=50;int r[4]= {0,-1,0,1},c[4]= {1,0,-1,0};int A[3*maxn+10][3*maxn+10],ch[11][3][3];int ind[maxn+10][maxn+10];char s[maxn+10][m 阅读全文

posted @ 2011-09-22 21:47 _Clarence 阅读(126) 评论(0) 推荐(0) 编辑

ACM PKU 1979 Red and Black

摘要: 题目链接:http://poj.org/problem?id=1979突然发现今天刷水题的速度上来了,而且是刷一个AC一个,哈哈#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=20;int W,H,ans,sx,sy;int r[4]= {0,-1,0,1},c[4]= {1,0,-1,0};char C[maxn+10][maxn+10];bool charge(int x,int y){ if(x<0||y<0|| 阅读全文

posted @ 2011-09-22 20:55 _Clarence 阅读(131) 评论(0) 推荐(0) 编辑

ACM PKU 1562 Oil Deposits

摘要: 题目链接:http://poj.org/problem?id=1562这道题相当尴尬了,两个一样的程序换个输入就A了,改成一个个字母读入就wa了,不知道为什么,希望大家能指出错误之处,不胜感激;AC的代码:#include <iostream>#include <cstring>#include <cstdio>using namespace std;const int maxn=100;char ch[maxn+10][maxn+10];int r[8]= {0,-1,-1,-1,0,1,1,1},c[8]= {1,1,0,-1,-1,-1,0,1};in 阅读全文

posted @ 2011-09-22 20:27 _Clarence 阅读(128) 评论(0) 推荐(0) 编辑

ZOJ 2110 Tempter of the Bone

摘要: 题目描述:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2110这是在ZOJ上做的第一道题,题目倒不是很难,悲剧的是剪枝太多,我悲剧了两个晚上,今天终于做出来了,很高兴!贴一下我的代码,顺便奉上《图论算法理论应用与实践》上的解析代码供大家参考;我的代码:#include <iostream>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int x,y,M,N,T,dx,dy;b 阅读全文

posted @ 2011-09-22 19:30 _Clarence 阅读(149) 评论(0) 推荐(0) 编辑

2011年9月21日

ACM PKU 1659 Frogs' Neighborhood

摘要: 题目链接:http://poj.org/problem?id=1659这里介绍一个定理:Havel-Hakimi定理;由非负整数组成的非增序列s:d1,d2,d3... ...,dn(n>=2,d1>=1)是可图的,当且仅当序列s1:d2-1,d3-1... ... d(d1+1)-1,d(d1+2),...,dn是可图的。序列s1中有n-1个非负整数,s序列中d1后的前d1个度数(即d2~d(d1+1))减1后构成s1中的前d1个数。#include <iostream>#include <cstring>#include <cstdio>#i 阅读全文

posted @ 2011-09-21 19:46 _Clarence 阅读(149) 评论(0) 推荐(0) 编辑

2011年9月9日

hdu 4006 The kth great number The 36th ACM/ICPC Asia Regional Dalian Site

摘要: 水题,比赛时就是没有做出来,强烈鄙视自己#include <iostream>#include <cstring>#include <cstdio>#include <set>using namespace std;multiset<int>myset;int main(){ int n,k; //freopen("in.txt","r",stdin); while(scanf("%d%d",&n,&k)!=EOF){ char s[2]; int temp; 阅读全文

posted @ 2011-09-09 09:24 _Clarence 阅读(123) 评论(0) 推荐(0) 编辑

2011年9月7日

hdu 4002 Find the maximum 欧拉函数 The 36th ACM/ICPC Asia Regional Dalian Site

摘要: 这道题其实只要掌握欧拉函数的定义就可以做出来,只要想到了在Java的大数下就是水题;import java.math.BigInteger;import java.util.Scanner;public class Main { static int maxn = 1001; static boolean[] flag = new boolean[maxn]; static int[] p = new int[maxn]; static BigInteger[] ans = new BigInteger[maxn]; static int t = 1; public static void m 阅读全文

posted @ 2011-09-07 20:22 _Clarence 阅读(139) 评论(0) 推荐(0) 编辑

2011年8月31日

ACM PKU 3734 Blocks

摘要: 题目描述:http://poj.org/problem?id=3734递推公式:E(t)=(1+t+t^2/2!+......+..)^2*(1+t^2/2!+t^4/4!+..+)^2 =e^2t*((e^t+e^-t)/2)^2 =1/4(e^4t+2*e^2t) =sigma(1/4*[4^n+2*2^n]*t^n/n!) n=0,1,2,,, ==> a(n)=1/4(4^n+2*2^n)#include <iostream>#include <cstring>#include <cstdio>const int M = 10007;using 阅读全文

posted @ 2011-08-31 20:48 _Clarence 阅读(143) 评论(0) 推荐(0) 编辑

ACM PKU 1061 青蛙的约会

摘要: 题目描述:http://poj.org/problem?id=1061#include <cstring>#include <cstdio>long long x,y,m,n,L,X,Y;long long gcd(long long a, long long b){ if(b==0)return a; else return gcd(b,a%b);}long long ext_gcd(long long a,long long b,long long& x,long long& y){ long long t,ret; if (!b) { x=1... 阅读全文

posted @ 2011-08-31 18:28 _Clarence 阅读(150) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 17 下一页

导航