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'spe原创 2013-08-07 10:05:02 · 1142 阅读 · 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 · 1484 阅读 · 0 评论 -
hdu-4763 kmp next数组的应用
http://acm.hdu.edu.cn/showproblem.php?pid=4763求最长的三个不重叠公共前缀,要求EAEBE的格式 即要求第一个在字符串开头 第三个在末尾 中间不能和首尾重叠刚开始就往后缀数组想 想了好久发现时间复杂度不可能呀 然后就想起了以前poj上水过的一题http://blog.csdn.net/fire_cat11211022/article原创 2013-09-28 20:45:16 · 1533 阅读 · 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 · 694 阅读 · 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 · 765 阅读 · 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 31625int flag[nmax], prime[nmax];int plen;void原创 2013-08-24 12:44:30 · 1026 阅读 · 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 · 1317 阅读 · 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 · 824 阅读 · 0 评论 -
hdu-1316 大数类模板
http://acm.hdu.edu.cn/showproblem.php?pid=1316包括大数的加减乘数 比较大小 取模 次方 输入输出 等的重载#include#include#include#include #include #includeusing namespace std;#define MAXN 9999#define MAXSIZE 100#def原创 2013-08-23 14:03:38 · 924 阅读 · 1 评论 -
hdu-4587-线段树的区间操作- lazy标记
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4578题目大意:给你一个数组,初始值为零1 x y c 代表 把区间 [x,y] 上的值全部加c2 x y c 代表 把区间 [x,y] 上的值全部乘以c3 x y c 代表 把区间 [x,y]上的值全部赋值为c4 x y p 代表 求区间 [x,y] 上值的p次方和1线段树原创 2013-08-11 12:38:09 · 999 阅读 · 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 · 719 阅读 · 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 · 688 阅读 · 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 · 1261 阅读 · 0 评论 -
hdu-1166 敌兵布阵
http://acm.hdu.edu.cn/showproblem.php?pid=1166单点更新 区间求和 睡前一水~#include #include #include #include #include #include using namespace std;#define MAX 50010typedef struct{ int l;原创 2013-08-20 01:50:42 · 634 阅读 · 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 · 1337 阅读 · 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 200010typedef struct{ int l; int原创 2013-08-20 00:03:19 · 638 阅读 · 0 评论 -
hdu-1556 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1556可以说这是线段树的水题了么...注意输出格式 最后没有空格#include #include #include #define MAX 100010using namespace std;typedef struct{ int l; int r; int原创 2013-08-19 22:30:22 · 562 阅读 · 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 · 1495 阅读 · 0 评论