摘要: 中文题面: http://acm.hdu.edu.cn/showproblem.php?pid=1176 思路: 这是个二维dp dp[t][x] 前者表示时间,后者表示坐标 那么转移方程就是 dp[t][x] = max(dp[t-1][x], dp[t-1][x+1], dp[t-1][x - 阅读全文
posted @ 2017-04-08 20:43 BOSON+CODE 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题意: 给出上限体重W 然后还给出每个人的体重wi 和 魅力值 bi 互为伙伴的对(xi, yi) 可以凑成group 思路: 并查集找出所有的group 暴力背包 对于每一个group 要选出这一组内选一个人时的最优结果, 如果所有人的体重和小于等于W,还得考虑选所有人的情况 阅读全文
posted @ 2017-04-08 19:13 BOSON+CODE 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 题意: 给出一个黑箱子多项式,系数都是非负整数,要求只能用这个黑箱子两次(其实就是最少次数了),求出所有系数思路: 巧妙的构造, 设多项式为f(x) 那么 S = f(1), M = f(S+1), 然后拆分下来M M的每一位数字分别就是系数利用进制的思想对于 f(x) = a1*x^n + a2* 阅读全文
posted @ 2017-03-31 23:23 BOSON+CODE 阅读(137) 评论(0) 推荐(0) 编辑
摘要: int a[200]; int n; struct node { int l, r, p; //node() {} //node(int a, int b, int c) :l(a), r(b), p(c) {} }q[2000]; double f[200], g[200]; double cal(int i, int j) { return a[j] +... 阅读全文
posted @ 2017-03-28 11:15 BOSON+CODE 阅读(267) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int lim = 1e9; int ans[200000]; int c[200000]; struct query { int l, r; int k, cnt; int id; }q[200000], b[200... 阅读全文
posted @ 2017-03-12 11:19 BOSON+CODE 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 刚开始接触状压dp, 感觉就形式上来说还是比较固定的,和数位dp差不多,但是各种位运算还是不够熟练,用起来有点不是得心应手 还是得多练练,这部分代码还不是很好写。 题意: 中文题, 不多说了。 思路: dp[n][prestate][preprestate] 表示第n行的时候的状态是由前两行的状态推 阅读全文
posted @ 2017-03-09 13:03 BOSON+CODE 阅读(655) 评论(0) 推荐(0) 编辑
摘要: 题意: 讲一个16进制的数字num的每一位拆分下来 也就是sum = $\sigma(2 ^ a_i)$ 每一个a_i 都是不同的 举个栗子: $1014_16$ 就是 $2^1 + 2 ^ 0 + 2 ^ 4$ 求得的sum是个十进制的数字 然后将sum和num都化为二进制进行异或,如果异或后的值 阅读全文
posted @ 2017-03-02 10:31 BOSON+CODE 阅读(186) 评论(0) 推荐(0) 编辑
摘要: /*2-sat启蒙题目*/ /*其实2-sat我个人理解就是根据题目写出最终答案必然出现的情况的关系(可能多个) 然后判断能不能构成连通图*/ #include #include #include #include #include #include #include #include #include #include #include #include using ... 阅读全文
posted @ 2017-02-28 00:15 BOSON+CODE 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 经典的1D1D动态规划题目(这里就是1D1D动态规划经典的第二种, 平衡树去维护 f(n) = min{a[n]*x(i) + b[n]*y(i)}) http://wenku.baidu.com/link?url=oWsqGQ7qjdM-ASnQBP6KmZRc8yYXyxbM3Czq_rhWvX 阅读全文
posted @ 2017-02-20 21:25 BOSON+CODE 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://codeforces.com/contest/660/problem/F 这篇博客讲的挺详细的: (下面说的都是借用链接博客中的一些 Notations) http://blog.csdn.net/kg20006/article/details/51333093 这题真的是 阅读全文
posted @ 2017-02-17 16:15 BOSON+CODE 阅读(150) 评论(0) 推荐(0) 编辑