上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 52 下一页
摘要: 看了扩展KMP的思路,然后来写这题,没有看别人怎么写的,自己写的想死,各种纠结的小细节,而且感觉这个东西自己想是很难想到。终于知找到一道我用kmp无法解决的题目了,只知道用扩展kmp可以搞定。Revolving DigitsTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1111Accepted Submission(s): 319Problem DescriptionOne day Silence is interested in revol 阅读全文
posted @ 2013-07-29 09:40 chenhuan001 阅读(433) 评论(0) 推荐(0) 编辑
摘要: 不会,题意还是不理解,我感觉选的这个矩形没有一点要按同一个规则摆放吧。 如果是这样真心感觉做不出来。如果不是这样就是简单的kmp。 我是为了练习扩展kmp才来看这题的,结果,。。。貌似扩展kmp也可以做的样子. 但是kmp的做法更好理解吧Milking GridTime Limit:3000MSMemory Limit:65536KTotal Submissions:4859Accepted:2020DescriptionEvery morning when they are milked, the Farmer John's cows form a rectangular grid 阅读全文
posted @ 2013-07-28 16:19 chenhuan001 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 母函数分:普通型母函数,指数型母函数。————选自Tanky Woo普通型母函数主要是来求组合的方案数,而指数型母函数是求多重排列数。关于普通型母函数的讲解,以前写过:http://www.wutianqi.com/?p=596而指数型母函数主要是关于排列组合方面的问题。分别看两个比较典型的问题对比:普通母函数问题:有红球两个,白球、黄球各一个,试求有多少种不同的组合方案。指数型母函数问题:假设有8个元素,其中a1重复3次,a2重复2次,a3重复3次。从中取r个组合,求其组合数。下面是指数型母函数的定义:对于上面的问题“假设有8个元素,其中a1重复3次,a2重复2次,a3重复3次。从中取r个组 阅读全文
posted @ 2013-07-23 21:28 chenhuan001 阅读(548) 评论(0) 推荐(0) 编辑
摘要: 可以推出公式f[n]=f[n-1]+f[n-1]*2*(n-1)f[1]=1;数据量很大,最后又要进行gcd操作,java里竟然自带了一个gcd的函数,为了避免求大数取余和大数除法操作,还是用java比较快,而且这题对时间复杂度要求不是很高。/* * To change this template, choose Tools | Templates * and open the template in the editor. */import java.math.BigInteger;import java.util.Scanner;/** * * @author chen */public 阅读全文
posted @ 2013-07-19 15:17 chenhuan001 阅读(288) 评论(0) 推荐(0) 编辑
摘要: f[n+1]=(4*n+2)/(n+2)*f[n];由f[n]=C(n,2n)-C(n+1,2n)推导然后就是一些大数乘法和大数除法了。#include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3fffffff#define base 10000int g[110][110];void mmul(int s[],int tmp,int t[]){ for(int i=0;i=0;i--) { d=s... 阅读全文
posted @ 2013-07-18 21:11 chenhuan001 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 与第二类有些区别!#include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3ffffffftypedef long long int LL;#define N 22LL dp[N][N];LL sum[N];int main(){ //freopen("//home//chen//Desktop//ACM//in.text","r",stdin); //freopen("/ 阅读全文
posted @ 2013-07-17 18:18 chenhuan001 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 卡特兰数,第一类斯特林数,第二类斯特林数Catalan数 C(n),第一类Stirling数 s(p,k),第二类Stirling数 S(p,k)[卡特兰数,第一类斯特林数,第二类斯特林数]一.Catalan数 C(n) C(n) 的一个形象的例子是:2*n个括号,其中有n个前括号'('和n个后括号')',排成一列,满足所有括号都匹配的排列数。另一个例子是,n个1和n个-1,共2*n个数,排成一列,满足对所有0=0的排列数。 C(n)的递推公式是 C(n) = ∑(i = 0 : n-1) { C(n-1-i)*C(i) } C(n)的通项公式是 C(n) = 阅读全文
posted @ 2013-07-17 17:51 chenhuan001 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 不会斯特林数的只能用递推思想了,结果发现推出来的就是斯特林数。。。#include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3fffffff#define N 1010#define __int64 long long int#define MOD 1000000007typedef __int64 LL;LL dp[N][N];LL dp1[N][N];int main(){ //freopen("//home/ 阅读全文
posted @ 2013-07-17 11:33 chenhuan001 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 完全的乱搞题啊。。。 被坑的要死。拿到题目就觉得是规律题加构造题, 然后找了了几个小时无果,只知道n为奇数的时候是一定无解的,然后当n为偶数的时候可能有很多解,但是如果乱选择的话,很有可能形成无解的情况。然后想到了类似于估价函数之类的东西, 一开始我就想到了让几个关键的点设价值设成很大,然后在构造解的时候尽量不选这些点,然后。。。 发现数据到30左右就出错了。 然后再进一步的想,把每个点都估计一个价值,价值的大小为到0的距离。 然后就可以保证在构造解的时候尽量选离0远的点,这样一直选,一直选,一直选。。。就不可思议的过了。。。不知道具体证明,但是思想感觉没有错误。因为这题无解的情况就是过早的选 阅读全文
posted @ 2013-07-14 18:13 chenhuan001 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 二分查找题, 不知道用double的人,用LL果断错了。。。B. Stadium and Gamestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDaniel is organizing a football tournament. He has come up with the following tournament format:In the first several (possibly zero) stages, while th 阅读全文
posted @ 2013-07-14 12:14 chenhuan001 阅读(353) 评论(0) 推荐(0) 编辑
上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 52 下一页