ACM
文章平均质量分 77
vincentTsang
这个作者很懒,什么都没留下…
展开
-
KMP快速模式匹配的java实现
假期实在无聊赖啊。把这个算法实现了一下即算是打发时间也算练练手了。 KMP算法的关键是用归纳法计算失败函数。网上很详细了。下面直接给出代码。 /** * * @author Vincent * */ public class PatternMap { private String pat; //模式 private int [] f; //模式对应的失败函数 private S原创 2013-07-25 11:46:28 · 941 阅读 · 0 评论 -
杭电oj 水题1005的两种解的讨论
题:http://acm.hdu.edu.cn/showproblem.php?pid=1005 我的ac解 #include using namespace std; int main() { int a,b,n; int count=0; int ans[50]; while(true){ cin>>a; cin>>b;原创 2013-05-09 21:09:34 · 912 阅读 · 0 评论 -
Yahoo! Hack Beijing Challenge----Question 1的c++解
题: Given a rational number expressed as A/B where A and B are integers, find the position of Mth occurrence of digit D (0-9) after decimal point. For example 3/7 = 0.4285714285... (A=3, B=7),原创 2013-05-08 22:19:21 · 978 阅读 · 2 评论 -
FFT快速傅里叶变换以O(NlogN)的时间复杂度实现大数乘
任意一个整数均能表示成An*10^(n-1) + An-1*10^(n-2) + ... + A2*10^2 + A1*10 + A0的形式,视10为自变量X,则化为一个多项式。两数相乘转化为两多项式相乘。以系数表示法表示的多项式相乘其复杂度为N^2,若采用点值表示法,结合适当的点的选取,能实现O(NlogN)的算法。 若一个多项式的最高次为N-1,那么取N个点对(xi, yi)就能够唯一确原创 2013-08-22 21:33:19 · 5414 阅读 · 0 评论