随笔分类 -  HDU

1 2 3 4 5 ··· 19 下一页

 
HDU 5512
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5512gcd(a,b)的位置都是可以选的,之后判断一下奇偶#include #include using namespace std;int gcd(int a, int b) { return a == 0... 阅读全文
posted @ 2015-12-30 10:02 LegendaryAC 阅读(279) 评论(0) 推荐(1)
HDU 1863
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863复习考研练练写Prim,第一次写,乱搞的,有点难看邻接表+堆#include #include #include #include using namespace std;int n, m, cnt, ct,... 阅读全文
posted @ 2015-12-21 18:49 LegendaryAC 阅读(179) 评论(0) 推荐(0)
HDU 1710
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1710题意:给二叉树的先序遍历和中序遍历,确定后序遍历解法:复习专业课找的一题,根据先序遍历和中序遍历建树,再对树做后序遍历#include #include using namespace std;struct ... 阅读全文
posted @ 2015-11-28 22:34 LegendaryAC 阅读(242) 评论(0) 推荐(0)
HDU 5289
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5289给一个数列,求有多少区间,使得这些区间内的最大值减最小值小于k单调队列的功能:O(1) 插入,删除,最大or最小方法:枚举区间的后界,找前界(一定可以找到一个后界使得这个后界的前面所有满足要求,后面所有不满足... 阅读全文
posted @ 2015-07-22 13:39 LegendaryAC 阅读(728) 评论(0) 推荐(0)
HDU 1237
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1237表达式计算,方法是中缀转后缀,再计算。中间处理用栈操作讲解看http://blog.csdn.net/antineutrino/article/details/6763722这题是简易版本的,不用处理括号#i... 阅读全文
posted @ 2015-06-19 21:31 LegendaryAC 阅读(253) 评论(0) 推荐(0)
HDU 4771
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4771给一个地图,@是起点,给一些物品坐标,问取完所有物品的最小步数,不能取完输出-1物品数最多只有四个,状态压缩一下bfs即可#include #include #include #include #inclu... 阅读全文
posted @ 2015-06-18 23:31 LegendaryAC 阅读(306) 评论(0) 推荐(0)
HDU 1839
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1839题意:从1到n,要求时间小于等于T到达。每条边有一个容量,问最多能运多少货物。分析:最多能运的货物取决于路径上边的最小容量,所以二分容量,再用最短路判断时限即可。最短路里面多加一个判断保证走的边都能满足当前容... 阅读全文
posted @ 2015-06-16 17:12 LegendaryAC 阅读(246) 评论(0) 推荐(0)
HDU 5015
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5015矩阵是表示状态转移的利器这题m很大,n非常小,所以开始的思考角度是能否从当前列推出下一列。有了这个角度,矩阵构造是很简单的#include #include #include using namespace ... 阅读全文
posted @ 2015-06-16 16:29 LegendaryAC 阅读(356) 评论(0) 推荐(0)
HDU 3006
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3006注意到集合内数字最大只有14,状态压缩一下,然后枚举出所有状态#include #include #include using namespace std;int dp[1<<15];int main() {... 阅读全文
posted @ 2015-06-15 23:04 LegendaryAC 阅读(148) 评论(0) 推荐(0)
HDU 2276
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2276矩阵乘法可以解决的一类灯泡开关问题/*转移关系为 now left now*1 0 1 1 1 00 1 10 0 0可知F[i] = (f[i] + f[(n... 阅读全文
posted @ 2015-06-15 18:11 LegendaryAC 阅读(257) 评论(0) 推荐(0)
HDU 2254
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2254矩阵乘法两个经典问题的综合题,还要离散化和处理边界,好题啊好题题意容易理解错,每一天是独立的,所以根据加法原理方案数是G^1+G^2+...+G^t/*此题要求 (G^1+G^2+...+G^t2)-(G^1... 阅读全文
posted @ 2015-06-15 14:21 LegendaryAC 阅读(176) 评论(0) 推荐(0)
HDU 1536 & 1944
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1536http://acm.hdu.edu.cn/showproblem.php?pid=1944一样的题题意:先给一个集合,代表可能发生的转移。然后m个询问,可以理解为每次给l堆石子,每堆有hi个,问博弈策略直接... 阅读全文
posted @ 2015-06-10 23:55 LegendaryAC 阅读(168) 评论(0) 推荐(0)
HDU 1538
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1538经典经济学问题,海盗分金分析http://www.guokr.com/article/41423/#include #include using namespace std;int a[15];int mai... 阅读全文
posted @ 2015-06-09 00:11 LegendaryAC 阅读(205) 评论(0) 推荐(1)
HDU 2177
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2177威佐夫博奕,面对奇异局势既bk=ak+k时是必败点,其中bk>=ak,k=bk-ak别的处理和其他博弈相同,注意题目的数据取一堆的时候数据有问题#include #include #include #incl... 阅读全文
posted @ 2015-06-07 10:40 LegendaryAC 阅读(170) 评论(0) 推荐(0)
HDU 2176
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2176nim博弈的模型。要输出先手第一次取的情况,考虑角度是留给对手必败态#include #include using namespace std;int a[200005];int main() { in... 阅读全文
posted @ 2015-06-02 22:43 LegendaryAC 阅读(129) 评论(0) 推荐(0)
HDU 1209
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1209水题,按五个时针分针成的锐角从小到大排序,角度相同时间从早到晚,输出中间的那个时针一小时走30度,一分钟走0.5度,分针一分钟走6度,注意是锐角,大于180要用360减回去,为避免精度出问题统一乘2拒绝小数#... 阅读全文
posted @ 2015-02-03 00:39 LegendaryAC 阅读(171) 评论(0) 推荐(0)
HDU 1254
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1254暴搜,状态是四维的(箱子和人的坐标),向一个方向推箱子还要判断人能否走到推的位置,1A#include #include #include #include using namespace std;int n... 阅读全文
posted @ 2015-02-01 17:16 LegendaryAC 阅读(226) 评论(0) 推荐(0)
HDU 3353
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3353题目其实就是要把AB分解质因数,X是它们质因数的并集,D是质因数指数的和(如果有相同的质因数,把它们的指数做减法求绝对值)水题,wa了好多次,手抖最后把while敲成if...#include #includ... 阅读全文
posted @ 2014-11-30 23:14 LegendaryAC 阅读(153) 评论(0) 推荐(0)
HDU 3357
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3357给出公司间的控股关系,问有多少组不合法数据,自己控股自己不合法,a控股b,b控股c,则a控股c其实就是找环,加一条边如果出现环ans++,但是每次搜一遍有没有环会tle。此处用邻接矩阵处理,如果a要控股b,则... 阅读全文
posted @ 2014-11-30 19:17 LegendaryAC 阅读(177) 评论(0) 推荐(0)
HDU 4666
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4666求m维最远曼哈顿距离借鉴别人的思路http://www.cnblogs.com/jackge/archive/2013/08/14/3256402.html以二维平面为例:设距离最远的两点为 i, j,可知所... 阅读全文
posted @ 2014-11-30 17:31 LegendaryAC 阅读(629) 评论(0) 推荐(0)

1 2 3 4 5 ··· 19 下一页