摘要: 很明显的区间加减单点查询。但由于规模大,于是离散化。在离散化的时候,可以把要查询的点也加入离散化的数组中。#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) 编辑