上一页 1 2 3 4 5 6 7 8 9 10 ··· 20 下一页

2014年11月4日

Poj1830开关问题,高斯消元

摘要: 高斯消元的入门题。#include#include#include#include#include#includeusing namespace std;int Map[100][100];int gauss(int equ, int var){ int k; int col; for ... 阅读全文

posted @ 2014-11-04 08:13 一个西瓜 阅读(166) 评论(0) 推荐(0)

Poj3370Halloween treats鸽巢原理

摘要: 和上题差不多一样的搞法。#include#include#include#include#include#includeusing namespace std;const int maxn = 111111;int a[maxn]; int b[maxn];int vis[maxn];int mai... 阅读全文

posted @ 2014-11-04 08:11 一个西瓜 阅读(125) 评论(0) 推荐(0)

Poj2356Find a multiple鸽巢原理

摘要: 一定存在连续的k个数,使得他们的和能被n整除。设a[i]为前缀和a[1]%n ,a[2]%n,...,a[n]%n的值的范围#include#include#include#include#includeusing namespace std;typedef long long LL;int m... 阅读全文

posted @ 2014-11-04 08:10 一个西瓜 阅读(130) 评论(0) 推荐(0)

Poj3145Harmony Forever线段树+鸽巢原理

摘要: 小数据直接暴力,大数据查找0-mod — 1,mod — 2*mod-1,2*mod — 3*mod-1.....因为 n%mod 的范围#include#include#include#include#includeusing namespace std;typedef long long L... 阅读全文

posted @ 2014-11-04 08:05 一个西瓜 阅读(198) 评论(0) 推荐(0)

hiho16动态lca

摘要: 这个要好写点,就是dfs这棵树,将每个节点进入 和出去的位置都记录下来,然后找 所要求得两个点最后出现的位置之间的最小值 所对应的点,就是他们的最近公共祖先。#include#include#include#include#includeusing namespace std;const int m... 阅读全文

posted @ 2014-11-04 07:53 一个西瓜 阅读(360) 评论(0) 推荐(0)

hiho15周离线lca

摘要: 它上面讲的很详细。http://hihocoder.com/problemset/problem/1067?sid=210395#include#include#include#include#includeusing namespace std;const int maxn = 111111;in... 阅读全文

posted @ 2014-11-04 07:50 一个西瓜 阅读(182) 评论(0) 推荐(0)

hiho13周暴力求lca

摘要: 先求一个节点的所有先人,然后从另外一个节点开始向上找,找到第一个共同的先人就是最近公共祖先。#include#include#include#includeusing namespace std;int fathe[1222];int color[122];int father[1222];int ... 阅读全文

posted @ 2014-11-04 07:49 一个西瓜 阅读(212) 评论(0) 推荐(0)

hiho12周树形dp

摘要: #include#include#includeusing namespace std;const int maxn = 1111;int len;int head[maxn];//int father[maxn];struct Node{ int to; int next;}e[maxn *... 阅读全文

posted @ 2014-11-04 07:47 一个西瓜 阅读(177) 评论(0) 推荐(0)

hiho11周树的直径

摘要: 任意找一个点做根, 然后找到距离这个根最远的点,然后以这个点做根,再找距离这个根最远的点,两个距离和就是 树的直径。#include#include#include#include#include#includeusing namespace std;typedef long long LL;#de... 阅读全文

posted @ 2014-11-04 07:45 一个西瓜 阅读(180) 评论(0) 推荐(0)

2014年10月30日

Hdu5015 233 Matrix矩阵

摘要: 每一列能由前一列推过来,构造一个(n+2)*(n+2)的矩阵B,第k列 就等于 所构造的第一列A*B^(k-1)比如233 10 10 10 0 2333a1+233 * 1 1 0 = a1+233+2333a1+a2... 阅读全文

posted @ 2014-10-30 21:10 一个西瓜 阅读(227) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 20 下一页

导航