经典kmp 1 #include 2 #include 3 using namespace std; 4 5 int n,m; 6 int a[1000010],b[10010],next[10010]; 7 8 void getnext (int *s,int *next)...
分类:
其他好文 时间:
2014-07-22 22:52:33
阅读次数:
182
感言:以后中国高中生的专场还是慎入!!!!
A题目还是比较简单
AC代码:
#include
#include
using namespace std;
struct p
{
int number;
int val;
}num[105];
bool cmp(p x,p y)
{
if(x.val==y.val)
return x.number>...
分类:
其他好文 时间:
2014-07-22 22:49:34
阅读次数:
186
There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n.
The i-th child wants to get at least ai candies.
Jzzhu asks childre...
分类:
其他好文 时间:
2014-07-22 22:49:13
阅读次数:
237
题目描述: Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is...
分类:
其他好文 时间:
2014-07-22 22:48:53
阅读次数:
207
题目如下: Counting Subsequences Time Limit: 5000 MSMemory Limit: 65536 K Description ?"47 is the quintessential random number," states the 47 society. And there might be a grain of truth in that....
分类:
其他好文 时间:
2014-07-22 08:13:34
阅读次数:
281
DescriptionThere is a number of disjoint vertical line segments in the plane. We say that two segments are horizontally visible if they can be connect...
分类:
其他好文 时间:
2014-07-20 09:27:15
阅读次数:
351
---------------loop循环定义变量--------------------declare cursor c1 is select * from emp;# rec emp%rowtype;# i numeber:=1; # v_count number;begin# select count(*) into v_count from emp;#(1) open c1; loop...
分类:
数据库 时间:
2014-07-20 00:33:20
阅读次数:
334
1) !!:重复执行上一条指令2) !a:重复执行上一条以a为首的指令3) !number:重复执行上一条在history表中记录号码为number的指令4) !-number:重复执行前第number条指令5) !$:表示获得上一条命令中的最后一项内容6) 用Ctrl + r 组合键来进入历史搜索...
分类:
其他好文 时间:
2014-07-19 22:20:52
阅读次数:
262
这题目,,,真是。。。诶。坑了好久。给一个有向图。U->V表示U可以打败V并得一分。如果一个人的得分最高,或者他打败所有比自己得分高的人,那么此人就是king。现在给出每个人的得分,求最多可能有多少个king同时存在。可以证明,如果有k个人是king,那么至少有一种分配方案使得这k个king都是分数...
分类:
其他好文 时间:
2014-07-19 16:09:34
阅读次数:
208
UVA 11774 - Doom's Day
题目链接
题意:给定一个3^n*3^m的矩阵,要求每次按行优先取出,按列优先放回,问几次能回复原状
思路:没想到怎么推理,找规律答案是(n + m) / gcd(n, m),在topcoder上看到一个证明,如下:
We can associate at each cell a base 3-number, the log3(R...
分类:
其他好文 时间:
2014-07-19 14:06:19
阅读次数:
220