上一页 1 ··· 5 6 7 8 9 10 下一页

2016年3月21日

摘要: #include #include #include #include using namespace std; // http://soj.sysu.edu.cn/1159 string a, b; void add(string& a, string& b) { if(a.size() =0; i--, j--) { sum += a[i]-'0'; ... 阅读全文
posted @ 2016-03-21 22:18 SuperChan 阅读(133) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct Node { Node *l, *r; int x; Node(int x=0, Node *l=NULL, Node *r=NULL):x(x),l(l),r(r) {} }; class Tree { public: ... 阅读全文
posted @ 2016-03-21 20:30 SuperChan 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=34290 这道题是一道在树上面搜索的好题,要注意以下几点: 1. 如何将该问题转化为最小化问题?而且这个最小化问题有两个最小化目标,首要的是“点数”,其次是“仅被一盏灯照亮 阅读全文
posted @ 2016-03-21 16:45 SuperChan 阅读(185) 评论(0) 推荐(0) 编辑

2016年3月19日

摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18913 这道题是一道状态压缩DP的好题,有几点要注意的: 1.uva给出的题目不知道为何,题意是有些描述不清的,详见《训练指南》 2.这道题可以有很多写法,整个的dp求解 阅读全文
posted @ 2016-03-19 21:57 SuperChan 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19461 这道题是一道很好的线性DP的题目,这种双头都可以选取的,可以运用带有头、尾位置信息的状态 dp[i][j] := 以第i位开头,第j位结尾的子问题的最优解 dp[ 阅读全文
posted @ 2016-03-19 20:17 SuperChan 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19051 首先,这题一看就知道是——最长公共子序列(LCS) 但是,会发现这道题的字符串长度可能达到62500,我们现在会的LCS的解法时间复杂度为O(n^2),所以是会超 阅读全文
posted @ 2016-03-19 18:09 SuperChan 阅读(506) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=11350 约瑟夫环问题 这道题问的是最后死的是那个数字,所以可以不需要模拟,直接通过递推来推出最后幸存的那个数字: 声明:这里我们将所有人的编号都减1。比如8个人的编号变为 阅读全文
posted @ 2016-03-19 17:21 SuperChan 阅读(224) 评论(0) 推荐(0) 编辑

2016年3月18日

摘要: 题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=16454 1.对于每一颗流星而言,真正有意义的是它穿越矩形的有效时间,所以其实我们需要得到所有流星的有效时间 2.这样的话,原问题就转化更加具体的:某个时刻最多同时穿过多少 阅读全文
posted @ 2016-03-18 00:49 SuperChan 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19048 为了节省开支,但是又想完成杀死所有恶龙的任务,我们可以采用贪心的策略: 1.将所有骑士身高排序,将所有恶龙的头按照直径排序 2.依次让当前最弱的骑士去“挑战”, 阅读全文
posted @ 2016-03-18 00:17 SuperChan 阅读(98) 评论(0) 推荐(0) 编辑

2016年3月17日

摘要: 题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=42065 阅读全文
posted @ 2016-03-17 22:43 SuperChan 阅读(188) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页

导航