上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 48 下一页
  2013年2月19日
摘要: http://poj.org/problem?id=2754先把low--up 转化为0--(up-low)然后变成背包 背包的关键在于多重背包用二进制优化代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#include<queue>#includ 阅读全文
posted @ 2013-02-19 15:53 夜-> 阅读(195) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1944代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#include<queue>#inclu 阅读全文
posted @ 2013-02-19 08:39 夜-> 阅读(211) 评论(0) 推荐(1) 编辑
  2013年1月31日
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1947题意:给出一个表达式 然后两个人轮流对表达式进行操作 每一次操作就加一个括号将一个运算符和两边的数括起来运算 变成一个数(运算结果)第一个人希望最后结果越大越好 第二个人希望结果越小越好 两人轮流来第一次 第一个人先开始 得到的结果为 r1第二次 第二个人先开始 得到的结果为 r2如果 r1>(-r2) 第一个人胜利如果 r2<(-r2)第二个人胜利否则平局思路:dfs 搜索所有解空间 当该第一个人操作时 枚举括号加在哪里 取 阅读全文
posted @ 2013-01-31 16:23 夜-> 阅读(247) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1945题目不难 dfs 就可以 不过后台数据相当的大 所以要尽量优化我是边搜边判代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include& 阅读全文
posted @ 2013-01-31 13:10 夜-> 阅读(391) 评论(2) 推荐(1) 编辑
  2013年1月30日
摘要: http://codeforces.com/contest/268/problem/E这道题的关键在于要提前排序 假设有两个相邻的顺序为(l1,p1) (l2,p2)这样的话时间为 四种可能性的和1,(l1+l2)*p1*p22,(2*l1+l2)*p1*(1-p2)3,(l1+l2)*(1-p1)*p24,(l1+l2)*(1-p1)*(1-p2)相反顺序的话 (l2,p2) (l1,p1)1,(l2+l1)*p1*p22,(2*l2+l1)*p2*(1-p1)3,(l2+l1)*(1-p2)*p14,(l2+l1)*(1-p2)*(1-p1)第一种顺序是我们选择的所有要大于第二中顺序 经过 阅读全文
posted @ 2013-01-30 10:06 夜-> 阅读(210) 评论(0) 推荐(0) 编辑
  2013年1月26日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1569枚举每一个点为起点 进行广搜 比较每次搜到的树 选择最优的一种结果代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#include<queue> 阅读全文
posted @ 2013-01-26 20:45 夜-> 阅读(331) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1339对于喜欢的关系看做是一个单向边 这样整个图 有一些单个的点 也会有一些长链 也会有一些环对于长链 从头开始进行配对 最后一个可能剩下变成单个点然后对环进行配对 一定正好是偶数然后单个点进行配对代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stac 阅读全文
posted @ 2013-01-26 11:19 夜-> 阅读(233) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1277拆点建图 dinic 加一点小优化代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#include<queue>#include<alg 阅读全文
posted @ 2013-01-26 10:04 夜-> 阅读(215) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1421网络流 dinic 勉强过代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<map>#include<vector>#include<stack>#include<set>#include<map>#include<queue>#include<algorit 阅读全文
posted @ 2013-01-26 09:25 夜-> 阅读(194) 评论(0) 推荐(0) 编辑
  2013年1月25日
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1040刚开始 "If there are several flights that depart from one airport then the greatest common divisor of their flight numbers should be equal to 1" 这句话理解错了呀 意思应该是从某个机场出发的所有航班的编号最大公约数为1 唉 英语是硬伤呀这个题需要用的到的一点是 gcd(x,x+1)==1 又由于原图是一个联通图(虽然题目中没有说)所有 阅读全文
posted @ 2013-01-25 18:55 夜-> 阅读(288) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 48 下一页