题目大意,求这个字符串到i为止有多少个循环串;int k = i-next[i]; if((i+1)%k == 0 && (i+1)!= k) printf("%d %d\n", i+1, (i+1)/k);这是代码的主要部分,求next数组的部分...
分类:
其他好文 时间:
2014-07-21 09:34:02
阅读次数:
213
public static void importExcel2(File file) throws Exception { InputStream is = new FileInputStream(file); Workbook workbook; ...
分类:
其他好文 时间:
2014-07-21 09:33:49
阅读次数:
220
约瑟夫环是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围。从编号为k的人开始报数,数到m的那个人出列;他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重复下去,直到圆桌周围的人全部出列。
C代码如下:
#include
#include
#include
typedef struct _node
{
struct _node* next;...
分类:
其他好文 时间:
2014-07-21 09:32:50
阅读次数:
222
这里要注意的就是:先给糖果,然后如果有人糖果数为奇数,就加1 ,然后再判断是不是相等...
分类:
其他好文 时间:
2014-07-21 09:31:25
阅读次数:
221
UVA 10870 - Recurrences
题目链接
题意:f(n) = a1 f(n - 1) + a2 f(n - 2) + a3 f(n - 3) + ... + ad f(n - d), for n > d.
已知前d项求第n项
思路:矩阵快速幂,对应矩阵为
|a1 a2 a3 ... ad|
|1 0 0 ... 0 0 0|
|0 1 0 ... 0 0 ...
分类:
其他好文 时间:
2014-07-21 09:30:29
阅读次数:
211
题目链接:点击打开链接
嘿嘿
#include
#include
#include
#include
#include
#include
#include
#define N 2011
using namespace std;
int lef[N], pn;//lef[v]表示Y集的点v 当前连接的点 , pn为x点集的点数
bool T[N]; //T[u] 表示Y集 u 是否已连...
分类:
其他好文 时间:
2014-07-21 09:30:20
阅读次数:
262
题意:即3个连续的wbw算是一个love,看一下某个区间共有多少个love,多次询问。还有替换某个位置的字母,然后询问。
用树状数组处理,题目并不难,但因为一处想当然错了N次。。。
题目链接:
Panda
#include"stdio.h"
#include"string.h"
#define N 50005
#define lowbit(i) (i&(-i))
char str[...
分类:
其他好文 时间:
2014-07-21 09:30:12
阅读次数:
271
给定一棵二叉树, 如何确定这棵二叉树的高度(即树的最大的深度), 是一个很常见的问题。
给下图回顾一下:
关于高度和深度的概念, 参见上图。
NOTE: 高度: 参考节点是距离节点最远的叶子
深度: 参考节点是根节点
寻找二叉树的高度也可以通过一个递归函数(a recursive function)实现, 这依然源于树是一个递归的数据结构。
例如, 对于下图, 我们可以求出根...
分类:
编程语言 时间:
2014-07-21 09:18:35
阅读次数:
344
3.1搜索的简单实现1.创建IndexReaderpackagecom.mzsx.index;
importjava.io.File;
importjava.io.IOException;
importorg.apache.lucene.index.CorruptIndexException;
importorg.apache.lucene.index.IndexReader;
importorg.apache.lucene.store.Directory;
importorg.apac..
分类:
其他好文 时间:
2014-07-20 15:26:11
阅读次数:
313