- 博客(7)
- 资源 (2)
- 收藏
- 关注
原创 cows(树状数组)
有n头牛,每头牛有一个领地范围(s1, e1),如果另一头牛的领地(s2, e2)覆盖住了这头牛则称那头牛比这头牛强壮,stars那题的变形#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> using namespace std;struct node { int s, e, n;
2016-04-23 18:44:48 271
原创 Mobile phones(二维树状数组)
输入 当输入0时,输入矩阵大小 输入1时,输入x, y,a;(x, y)点加上a; 输入2时,输入x1, y1, x2, y2;求(x1, y1)(x2, y2)构成矩阵的大小#include <stdio.h> #include <string.h> #include <iostream> int c[1100][1100], n; int lowbit(int x) { retur
2016-04-23 18:20:42 226
原创 poj 2299 Ultra-QuickSort(求逆序数 )
给一个序列,求最小交换次数使他变成递增序列 转换为求逆序数树状数组 不懂为何开int就会wa #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> using namespace std;struct node { long long x, y; } a[700000]; bool
2016-04-21 17:12:38 166
原创 hdu1068(二分)Girls and Boys
最大独立集 = 节点 - 最大匹配#include <stdio.h> #include <string.h> const int MAXN = 5010;//点 const int MAXM = 50010;//边 struct Edge { int to, next; } edge[MAXM]; int head[MAXN], tot; void init() { tot = 0
2016-04-19 20:40:33 212
原创 hdu2594 Simpsons’ Hidden Talents (kmp)
next数组的理解,注意输出的长度不能大于s1和s2的最小长度 注意是多组数据 开始不知道让我wa的莫名其妙 #include <stdio.h> #include <string.h> #include <iostream> using namespace std; char s1[120000], s2[60000], s3[60000]; int f[120000]; int len; vo
2016-04-02 22:43:50 312
原创 poj3080 kmp
1.直接用string#include <stdio.h> #include <string.h> #include <iostream> using namespace std; string str[15]; int main() { ios::sync_with_stdio(0); int T, i, j, n, k; cin >> T; string tmp,
2016-04-02 20:27:59 295
原创 poj2752 kmp 模板题
1.当一个s[j]与p[i]失配时,跳转至s[next[j]],说明了s[0] ~s[next[j]]与s[j - next[j]] ~ s[j]这两段字符是相同的,想一想就懂了; 2.递归输出; #include <stdio.h> #include <string.h> #include <iostream> using namespace std; int f[401000], len; ch
2016-04-01 17:55:24 155
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人