上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 38 下一页
摘要: 考虑到有留在原地概率为1的情况,好吧,我直接把它置0.然后,真的过了。还是使用逆推。。#include #include #include #include #define N 1005using namespace std;double qi[N][N];double p[N][N][3];int... 阅读全文
posted @ 2014-11-16 11:11 chenjunjie1994 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 简单的概率DP,求期望,逆推更好。#include #include #include #include #define N 100005using namespace std;double p[N];struct e{ int u,v; int next;}edge[1010];int head[... 阅读全文
posted @ 2014-11-16 10:11 chenjunjie1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 开始时直接设了一个状态,dp[i][j]为发现i种bug,j个系统有bug的期望天数。但很错误,没能转移下去。。。。看了题解,设状态dp[i][j]为已发现i种bug,j个系统有bug,到完成目标状态所需要的期望的天数。妙啊,这样一设状态,就很好更解了。如,由dp[i][j]可以到达状态dp[i][... 阅读全文
posted @ 2014-11-15 22:09 chenjunjie1994 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 一个很直观的想法是,求出每个点上下左右能到达的最大长度。然后枚举其斜边。。。没想到过了。。。。当然,题解有一个很巧妙的优化,利用树状数组,那个太巧妙了。#include#include#include#include#include#includeusing namespace std;int t,... 阅读全文
posted @ 2014-11-15 19:53 chenjunjie1994 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 三个摄像头,在XOY上与立体的点求出在平面上的交点,然后求出凸包。三个凸包相交的面积即是所求,即是可以用半平面交的方法求解了。模板题了。代码拿别人的。#include#include#include#includeusing namespace std;const int mm=111;typede... 阅读全文
posted @ 2014-11-12 21:10 chenjunjie1994 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 悬线法可解,稍有点烦琐。#include #include #include #include using namespace std;char map[1010][1010];int lefts[1010][1010],heights[1010][1010],rights[1010][1010];... 阅读全文
posted @ 2014-11-12 20:44 chenjunjie1994 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 果然换个编译器就过了。总的来说,不难,不过就是处理一些空格。学习了一个新的类 istringstream可以按空格划分。然后,那条式子要理解。式子的意义是:找到一个串,该串在query中是第几个找到/它的实际位置。之和再除以给出的有几个串就是AVEP#include #include #includ... 阅读全文
posted @ 2014-11-10 16:18 chenjunjie1994 阅读(129) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/staginner/archive/2012/08/13/2636826.html自己看过后两周吧,重新写了一遍。很受启发的。对于0、1,可以使用最小割的思想来做,以前有听说过0、1规划的问题,估计就是这样的了。对这个题目使用最小割 ,是一个非常巧妙的思... 阅读全文
posted @ 2014-11-10 09:39 chenjunjie1994 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 很明显的区间加减单点查询。但由于规模大,于是离散化。在离散化的时候,可以把要查询的点也加入离散化的数组中。#include #include #include #include #define lowbit(x) ((x)&(-x))#define LL __int64using namespace... 阅读全文
posted @ 2014-11-09 22:11 chenjunjie1994 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 直接DFS即可#include #include #include #include using namespace std;bool vis[2010];char map[2010][2010];struct e{ int u,v; int next;}edge[2050000];int head... 阅读全文
posted @ 2014-11-09 20:30 chenjunjie1994 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 编辑距离,经典的了。动态规划枚举即过。#include #include #include #include using namespace std;char bgn[1505][15];char tmp[15];int dp[15];int main(){ int T,n,m,kase=0,e,c... 阅读全文
posted @ 2014-11-09 18:02 chenjunjie1994 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 题意:给定a和b,n,让你求b+a, b+2*a, .......b+n*a里面有多少1.当统计第K位的时候 可以注意到 第 B+T*A 和 B+(T+2^(K+1))*A 位是相同的那么 第K位的时候 只需要统计2^(K + 1) - 1次就可以了 当统计第K位的时候 可以注意到 连续的 (2^K... 阅读全文
posted @ 2014-11-09 16:33 chenjunjie1994 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 只需A的全部质因数包含在B中即可。#include #include #define LL __int64#include using namespace std;LL gcd(LL a,LL b){ if (b==0) return a; return gcd(b,a%b);}int main()... 阅读全文
posted @ 2014-11-09 09:39 chenjunjie1994 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 可以知道,逃出的人中,最后一个应当是A+B最长的,这是很容易发现的。那么,最选逃出去的必定是A+B最短的。这符合最优。于是,可以把各小矮人按A+B的和由大到小排序。定义DP[i][j]为i个人中逃出了j个人至少需要“之前”的留在井中的未逃出去的小矮人的高度和。注意这个值是可以为负数的,是负数,则证明... 阅读全文
posted @ 2014-11-01 15:31 chenjunjie1994 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 很明显的树形DP了。但网上有的说可以用并查集。。。。考虑一棵子树,当根结点有机器人时,则必定所有子树都要和根结点断开,而根结点向上返回的路径值则为其父结点与根结点连边的权值。当根结点安全时,假设其子树有K个危险结点,而由于K个结点需要两两不能相连,那么,至少断开K-1个结点。则把权值最小的K-1断开... 阅读全文
posted @ 2014-11-01 15:21 chenjunjie1994 阅读(157) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 38 下一页