码迷,mamicode.com
首页 >  
搜索关键字:循环节    ( 617个结果
HDOJ 1097 A hard puzzle(循环节||快速幂)
Problem Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin. ...
分类:其他好文   时间:2015-08-26 20:12:04    阅读次数:135
hdu 3746 Cyclic Nacklace(kmp循环节)
题意:循环节思路:kmp#include#include#includeusing namespace std;#define MaxSize 100005int _next[MaxSize];void GetNext(char t[]){//求next数组 int j,k,len; j...
分类:其他好文   时间:2015-08-21 22:55:08    阅读次数:135
hdu 4333 Revolving Digits
先用KMP问题结局循环节的问题,再用拓展kmp解决 #include #include #define maxn 200010 using namespace std; string str,b; int nextt[maxn],extend[maxn]; void get_next() { int a=0; nextt[0]=b.size(); while(a<b.size()-1&&b...
分类:其他好文   时间:2015-08-20 16:53:33    阅读次数:113
hdu 2837 Calculation【欧拉函数,快速幂求指数循环节】
题意: 已知f(0) = 1,0^0 =1,【注意,0的其他任意次方为0,虽然题没有直接给出~】,还已知f(n) = (n%10)^f(n/10),让你求f(n)%m. (2 ≤ n , m ≤ 10^9) 分析: 求解一个递归式,f(n)递归下去是需要多次求幂的,这样,我们就可以用指数循环节来降幂处理,其实指数循环节就是欧拉函数+快速幂的一个结合而已,在这个题里面需要特别注意的就是对0的处理,求0的多次方需要进行判断一下。...
分类:其他好文   时间:2015-08-20 13:15:41    阅读次数:119
[NBUT 1224 Happiness Hotel 佩尔方程最小正整数解]连分数法解Pell方程
题意:求方程x2-Dy2=1的最小正整数解思路:用连分数法解佩尔方程,关键是找出√d的连分数表示的循环节。具体过程参见:http://m.blog.csdn.net/blog/wh2124335/8871535当d为完全平方数时无解将√d表示成连分数的形式,例如:当d不为完全平方数时,√d为无理数,...
分类:移动开发   时间:2015-08-20 01:07:17    阅读次数:567
hdu5392
求循环节加上线性求lcm 即lcm等于公共的质因子乘每个数本身的质因子。 代码:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ...
分类:其他好文   时间:2015-08-19 16:57:50    阅读次数:105
HDOJ 5392 Infoplane in Tina Town LCM
找循环节,分解质因数,求LCM Infoplane in Tina Town Time Limit: 14000/7000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1627    Accepted Submission(s): 380 Pro...
分类:其他好文   时间:2015-08-17 17:21:50    阅读次数:112
Period(KMP,循环节问题)
题意:求给你个串,前i位子串由某个字符串重复k次得到,求所有的i和k分析:i-next[i]恰好是一个循环节#include #include #include #include #include #include #include #include #include #include #inclu...
分类:其他好文   时间:2015-08-16 17:56:47    阅读次数:130
Power Strings - POJ 2406(求循环节)
题目大意:叙述的比较高大上,其实就是一个字符串B = AAAAAAA,求出来这个A最短有多长分析:注意如果这个串不是完全循环的,那么循环节就是就是它本身。代码如下:#include#includeconst int MAXN = 1e6+7;const int oo = 1e9+7;char s[M...
分类:其他好文   时间:2015-08-14 21:17:40    阅读次数:200
The Minimum Length - HUST 1010(求最小循环节)
题意:有个一字符串A(本身不是循环串),然后经过很多次自增变成AAAAA,然后呢从自增串里面切出来一部分串B,用这个串B求出来A的长度。分析:其实就是求最小循环节.......串的长度 - 最大的匹配。代码如下。============================================...
分类:其他好文   时间:2015-08-14 20:53:11    阅读次数:96
617条   上一页 1 ... 38 39 40 41 42 ... 62 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!