UVA 12206 - Stammering Aliens
题目链接
题意:给定一个序列,求出出现次数大于m,长度最长的子串的最大下标
思路:后缀数组,搞出height数组后,利用二分去查找即可
这题之前还写过hash的写法也能过,不过写后缀数组的时候,犯了一个傻逼错误,把none输出成node还一直找不到。。。这是刷题来第二次碰到这种逗比错误了,还是得注意。。
代码...
分类:
其他好文 时间:
2014-08-18 23:38:03
阅读次数:
282
The binomial coefficient C(m,n) is defined as
m!
C(m,n) = --------
n!(m-n)!
Given four natural numbers p, q, r, and s, compute the the result of dividing
C(p,q) by C(r,s).
T...
分类:
其他好文 时间:
2014-08-18 23:37:43
阅读次数:
274
Summation of sequence of integersis always a common problem in Computer Science. Rather than computing blindly,some intelligent techniques make the task simpler. Here you have to find thesummation of ...
分类:
其他好文 时间:
2014-08-18 22:10:23
阅读次数:
314
题目链接:uva 10808 - Rational Resistors
题目大意:给出一个博阿含n个节点,m条导线的电阻网络,求节点a和b之间的等效电阻。
解题思路:基尔霍夫定律,任何一点的电流向量为0。就是说有多少电流流入该节点,就有多少电流流出。
对于每次询问的两点间等效电阻,先判断说两点是否联通,不连通的话绝逼是1/0(无穷大)。联通的话,将同一个联通分量上的节点都扣出来,假设...
分类:
其他好文 时间:
2014-08-18 22:09:33
阅读次数:
394
题目链接:uva 1397 - The Teacher's Side of Math
题目大意:给出一个方程的解x=a1/m+b1/n,求原方程(给出系数即可)
解题思路:因为方程肯定等于0,所以对于各个系数ax/mby/n都会等于0,于是可以根据这个列出方程,注意最高项的系数始终为1.
#include
#include
#include
#include
using n...
分类:
其他好文 时间:
2014-08-18 22:09:13
阅读次数:
403
题目链接:uva 1564 - Widget Factory
题目大意:n种零件,m次工作日程,零件序号从1到n,给出m次工作日程的信息,x,s,e,表示生产了x个零件,从星期s开始到星期e(有可能是多个星期),然后给出生产的x个零件的序号。求每个零件被生产需要多少天(保证在3到10天)
解题思路:因为不能确定每个工作日程具体生产了几天,所以对应列出的方程均为线性模方程(模7),所以在...
分类:
其他好文 时间:
2014-08-18 22:08:23
阅读次数:
303
AC自动机UVa 11468 SubstringAC自动机+概率DP。注意要补全不存在的边。为什么要补全不存在的边呢?补全以后可以直接找到状态的转移,即从所有子节点就可以实现所有状态转移。#include#include#include#include#include#include#include...
分类:
其他好文 时间:
2014-08-18 21:59:23
阅读次数:
337
UVa 129 Krypton Factor注意输出格式,比较坑爹。每次要进行处理去掉容易的串,统计困难串的个数。#include#include#include#include#include#include#include#include#include#define INF 100000000...
分类:
其他好文 时间:
2014-08-18 21:56:12
阅读次数:
371
题目链接:uva 1549 - Lattice Point
题目大意:给定圆半径,以原点为圆心,求园内有多少个整数点。
解题思路:首先坐标轴将圆分成4份,所以只要单独考虑每一块的个数乘4再加1即可(原点)
#include
#include
#include
#include
using namespace std;
const double pi = 4 * atan(1...
分类:
其他好文 时间:
2014-08-18 20:33:52
阅读次数:
206