上一页 1 2 3 4 5 6 7 8 ··· 28 下一页

2015年2月25日

CC 3-Palindromes(manacher)

摘要: 传送门:3-Palindromes题意:求为回文串且能整除3且不前导0的子串个数。分析:由 manacher算法O(N)可算出以i为坐标的最长为p[i]回文子串,且Si-k,Si-k+1......Si+k-1,Si+k(0#include #include #include #include #i... 阅读全文

posted @ 2015-02-25 18:12 lienus 阅读(145) 评论(0) 推荐(0)

hdu3294(manacher)

摘要: 传送门:Girls' research题意:求最长回文串并输出位置及转换后的字符串。分析:manacher算法算出最长回文串后记录中心位置,然后再转换回原字符串的起始和结束位置。#pragma comment(linker,"/STACK:1024000000,1024000000")#includ... 阅读全文

posted @ 2015-02-25 15:27 lienus 阅读(161) 评论(0) 推荐(0)

hdu4513(manacher)

摘要: 传送门:吉哥系列故事——完美队形II题意:求最长回文队伍且队伍由中间向两边递减。分析:manach算法小应用,在判断回文子串向两边递减时加点限制使回文是由中间向两边递减的。#pragma comment(linker,"/STACK:1024000000,1024000000")#include #... 阅读全文

posted @ 2015-02-25 14:30 lienus 阅读(117) 评论(0) 推荐(0)

poj3974(manacher)

摘要: 传送门:Palindrome题意:给定一个字符串,求最长回文子串。分析:manach裸题,核心理解mx>i?p[i]=min(p[2*id-i],mx-i):1.#pragma comment(linker,"/STACK:1024000000,1024000000")#include #inclu... 阅读全文

posted @ 2015-02-25 13:15 lienus 阅读(201) 评论(0) 推荐(0)

CF 518D(概率dp)

摘要: 传送门:Ilya and Escalator题意:有n个人排队进车厢,每秒只能进一个人,而且第1个人进了后面的人才能进,第一个人每秒进入车厢的概率为p,不进的概率为1-p,求t秒后进入车厢总人数的数学期望。分析:设dp[i][j]表示第i秒进了j个人的概率,则:dp[i][j]=dp[i-1][j]... 阅读全文

posted @ 2015-02-25 11:09 lienus 阅读(226) 评论(0) 推荐(0)

2015年2月24日

loj1341(数学)

摘要: 传送门:Aladdin and the Flying Carpet题意:给出两个正整数1n答案必定为0,否则可以暴力1~m排除因子小于m的个数,这里稍微优化一下dfs排除小于m的因子个数。#pragma comment(linker,"/STACK:1024000000,1024000000")#i... 阅读全文

posted @ 2015-02-24 22:24 lienus 阅读(173) 评论(0) 推荐(0)

loj1370(欧拉函数+线段树)

摘要: 传送门:Bi-shoe and Phi-shoe题意:给出多个n(1=n的最小的x之和。分析:先预处理出1~1e6的欧拉函数,然后建立一颗线段树维护最大值,对于每个n询问大于等于n的最左边下标。#pragma comment(linker,"/STACK:1024000000,1024000000"... 阅读全文

posted @ 2015-02-24 20:31 lienus 阅读(197) 评论(0) 推荐(0)

loj1336(数学)

摘要: 传送门:Sigma Function题意:定义f(n)为n的约数之和,求[1,n]中f值为偶数的数的个数。分析:由题目给定公式可知,若f(n)为奇数,则相乘的每一项都必须为奇数。每一项为奇数的条件:(1)若pi=2,那么pi^0+pi^1+……pi^ei必为奇数;(2)若pi为奇素数,那么只有ei为... 阅读全文

posted @ 2015-02-24 15:44 lienus 阅读(272) 评论(0) 推荐(0)

loj1245(数学)

摘要: 传送门:Harmonic Number (II)题意:求sum=n/1+n/2+n/3+...+n/n。(n#include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-02-24 14:02 lienus 阅读(240) 评论(0) 推荐(0)

loj1236(数学)

摘要: 传送门:Pairs Forming LCM题意:题意:问符合 lcm(i,j)=n (1#include #include #include #include #include #include #include #include #include #include #include #includ... 阅读全文

posted @ 2015-02-24 13:49 lienus 阅读(319) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 28 下一页

导航