
hdu
文章平均质量分 77
devYzhou
Be a man,do the right thing
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu-4615 Partition
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4651 题目大意就是整数拆分 数据特别大,不能用以前的递归 所以。。。 不能百度 只能谷歌 http://en.wikipedia.org/wiki/Partition_%28number_theory%29 然后在里面找一个公式 Leonhard Euler's pe原创 2013-08-07 10:05:02 · 1206 阅读 · 0 评论 -
hdu-4762 大数处理 数学公式
http://acm.hdu.edu.cn/showproblem.php?pid=4762 公式为 N/(M^(N-1)) 有了以前的模板 大数类模板 直接改main函数就行、约分 int main() { BigNum a,b; int M,N; int T; scanf("%d",&T); while(T--) {原创 2013-09-28 20:52:40 · 1537 阅读 · 0 评论 -
hdu-4763 kmp next数组的应用
http://acm.hdu.edu.cn/showproblem.php?pid=4763 求最长的三个不重叠公共前缀,要求EAEBE的格式 即要求第一个在字符串开头 第三个在末尾 中间不能和首尾重叠 刚开始就往后缀数组想 想了好久发现时间复杂度不可能呀 然后就想起了以前poj上水过的一题 http://blog.youkuaiyun.com/fire_cat11211022/article原创 2013-09-28 20:45:16 · 1596 阅读 · 0 评论 -
hdu-4671 Backup Plan
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4671 水题不多说 记录代码 #include #include #include using namespace std; int a[101][101]; bool vis[101]; int main() { int n,m; while(~scanf("%d%原创 2013-08-14 01:08:17 · 739 阅读 · 0 评论 -
hdu-4666 Hyperspace
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4666 求k维的最远曼哈顿距离 没有初始化 最后wa了... #include #include #include #include #include #define MAXSIZE 60000+3 #define MAXTYPE ((1<<5)+3) #define INF原创 2013-08-13 23:57:52 · 816 阅读 · 0 评论 -
hdu-4704 (a^b)%c
http://acm.hdu.edu.cn/showproblem.php?pid=4704 求解(a^b)%c #include #include #include #include #define LL long long #define nnum 1000005 #define nmax 31625 int flag[nmax], prime[nmax]; int plen; void原创 2013-08-24 12:44:30 · 1090 阅读 · 0 评论 -
hdu-4577-X-Boxes
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4577 题目不解释了 c++用高精度太麻烦 所以xky大神在我一句一句说想法的时候用java写出来的 c++代码是#include #include #include using namespace std; int main() { int T; scanf("%d",原创 2013-08-10 19:27:34 · 1379 阅读 · 2 评论 -
hdu-4614Vases and Flowers 线段树区间赋值
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4614 题目是说给你一个区间然后初始值为0就是代表没有花 给你两种操作1 代表从A开始插F只花 花盆为空就查 不为空就往下一个推 直到花插完为止 如果一朵花都能插 就输出Can not put... 如果能就输出第一个插花位置 和最后一个插花位置, 多出来的花扔掉 2 代表把区间A,B原创 2013-08-11 23:00:58 · 900 阅读 · 0 评论 -
hdu-1316 大数类模板
http://acm.hdu.edu.cn/showproblem.php?pid=1316 包括大数的加减乘数 比较大小 取模 次方 输入输出 等的重载 #include #include #include #include #include #include using namespace std; #define MAXN 9999 #define MAXSIZE 100 #def原创 2013-08-23 14:03:38 · 997 阅读 · 1 评论 -
hdu-4587-线段树的区间操作- lazy标记
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4578 题目大意:给你一个数组,初始值为零 1 x y c 代表 把区间 [x,y] 上的值全部加c 2 x y c 代表 把区间 [x,y] 上的值全部乘以c 3 x y c 代表 把区间 [x,y]上的值全部赋值为c 4 x y p 代表 求区间 [x,y] 上值的p次方和1 线段树原创 2013-08-11 12:38:09 · 1055 阅读 · 0 评论 -
hdu-4576-Robot 二分&DP
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4576 题目有意思 一开始就觉得直接DP会超时 就没敢写 可是后来他们竟然都过了.... 这题因为概率和走步的顺序无关 所以先把走相同步数的先统计 相同步数统计出后二分合并,再和其他步数的合并 #include #include #include #define MA原创 2013-08-10 20:28:16 · 770 阅读 · 0 评论 -
hdu-4632-Palindrome subsequence DP&回文字串
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4632 题意是找一个字符串有多少个字串是回文字串,字串可以不连续 就是一个dp a[i][j] 表示在i和j的范围中有多少个字串是回文字 如果是s[i]=s[j] 则 a[j][j+i]=a[j+1][j+i]+a[j][j+i-1]+1 否则 a[j][j+i]=a[j+1][j+i]+原创 2013-08-10 20:16:29 · 735 阅读 · 0 评论 -
hdu-4585-Shaolin 平衡二叉树
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4585 就是维持顺序的问题 用的平衡二叉树,太弱 不会 map/set 自己套的模板 写的平衡二叉树 200+的代码 用map 30+的代码 想哭。。。 #include #include #include #include #include #include #defin原创 2013-08-10 19:58:59 · 1325 阅读 · 0 评论 -
hdu-1166 敌兵布阵
http://acm.hdu.edu.cn/showproblem.php?pid=1166 单点更新 区间求和 睡前一水~ #include #include #include #include #include #include using namespace std; #define MAX 50010 typedef struct { int l;原创 2013-08-20 01:50:42 · 673 阅读 · 0 评论 -
hdu-4691 最长公共前缀-后缀数组
http://acm.hdu.edu.cn/showproblem.php?pid=4691 解析:当然用后缀数组最方便,在后缀数组中有很多重要的定义和性质,现在我们来认识一些: 定义:LCP(i,j)=suffix(SA[i])与suffix[SA[j]]的最长公共前缀长度,即排号序后的后缀中第i名和第j名的最长公共前缀长度。 然后我们再用一个重要的性质就可以求出LCP(i,j)了,性原创 2013-08-20 21:58:02 · 1413 阅读 · 0 评论 -
hdu-1754 I Hate It 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1754 求区间最大数,并且有单点操作 #include #include #include #include #include #include using namespace std; #define MAX 200010 typedef struct { int l; int原创 2013-08-20 00:03:19 · 683 阅读 · 0 评论 -
hdu-1556 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1556 可以说这是线段树的水题了么... 注意输出格式 最后没有空格 #include #include #include #define MAX 100010 using namespace std; typedef struct { int l; int r; int原创 2013-08-19 22:30:22 · 622 阅读 · 0 评论 -
hdu-4764 博弈
http://acm.hdu.edu.cn/showproblem.php?pid=4764 由题意可知 胜的一方必须是拿到N-1这个数 那么输的一方肯定是在 N-k-1 ~ N-2 这些数中取 那么赢的一方必然取到了N-k-2这个数 所以一次递归推算 先手取到这些特殊数的必赢 这些数为 N-1、N-1-(k+1)、N-1-2(k+1) ...... 所以得如果N-1 能够整除 k+原创 2013-09-28 21:08:00 · 1554 阅读 · 0 评论