删除树节点 #pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorith ...
分类:
其他好文 时间:
2018-02-22 21:22:18
阅读次数:
144
http://poj.org/problem?id=3533 变成三维的nim积。。前面那个二维的函数都不用改多nim积一次就过了。。。longlong似乎不必要但是还是加上了 代码 1 #include<cstdio> 2 #include<cstring> 3 #include<algorith ...
分类:
其他好文 时间:
2018-01-24 12:28:22
阅读次数:
176
【题解】 二分答案+差分 本题要求出尽量小的威力值P,很容易想到二分答案 而本题难点在于二分答案之后的检验。每发子弹对一个区间造成影响,我们可以尝试使用差分。但每发子弹对区间不同位置的影响是不同的。因此我们可以用多阶差分。 1 #include<cstdio> 2 #include<algorith ...
分类:
其他好文 时间:
2017-12-15 19:36:03
阅读次数:
161
水题。 把弧长和sum求出,若为奇数显然无解。 从1~n-1枚举,找出一段和为sum/2的段的个数。 ans=tot*(tot-1)/2; //Twenty #include<cstdio> #include<cstdlib> #include<iostream> #include<algorith ...
分类:
其他好文 时间:
2017-09-29 10:07:37
阅读次数:
179
各种文本编辑器的” 查找” 功能(Ctrl+F),大多采用 Boyer-Moore 算法。 下面,我根据 Moore 教授自己的例子来解释这种算法。。 假定字符串为”HERE IS A SIMPLE EXAMPLE”,搜索词为”EXAMPLE”。 首先,” 字符串” 与” 搜索词” 头部对齐,从尾部 ...
分类:
编程语言 时间:
2017-09-27 18:53:18
阅读次数:
259
http://blog.csdn.net/v_july_v/article/details/7041827 -- 讲解在靠后的位置 http://www.ruanyifeng.com/blog/2013/05/boyer-moore_string_search_algorithm.html ...
分类:
编程语言 时间:
2017-09-24 16:49:23
阅读次数:
128
老规矩, 先看看维基定义: The time complexity of an algorithm quantifies the amout of time taken by an algorithm to run as function. The complexity of an algorith ...
分类:
其他好文 时间:
2017-09-24 10:43:41
阅读次数:
150
老规矩, 先看看维基定义: The time complexity of an algorithm quantifies the amout of time taken by an algorithm to run as function. The complexity of an algorith ...
分类:
其他好文 时间:
2017-09-24 00:30:25
阅读次数:
218
根据阮一峰大大的文章实现,不过没实现“搜索词中的上一次出现位置”(我直接实时查找,显然应该预处理): 文章:http://www.ruanyifeng.com/blog/2013/05/boyer-moore_string_search_algorithm.html 代码: ...
分类:
编程语言 时间:
2017-09-18 00:26:24
阅读次数:
258
A(0)=A(1)=1,A(i)=X*A(i-1)+Y*A(i-2),求S(n)=A(0)^2+A(1)^2+A(2)^2+A(3)^2+……+A(n)^2。 这个矩阵有点毒。。 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorith ...
分类:
其他好文 时间:
2017-09-01 14:29:21
阅读次数:
135