- 博客(8)
- 收藏
- 关注
原创 poj 3984 迷宫问题 BFS+栈的使用
#include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> using namespace std; int dir[]={-1,0,1,0}; ///上下左右四个移动方向int dil[]={0,...
2015-11-24 14:09:10 240
原创 neu 1438 Car race game 树状数组求解前缀和
#include <bits/stdc++.h> using namespace std; #define lowbit(i) i&(-i) const int N = 1000000 +10; int n,m,k,l,r; int a[N]; int getsum(int i) { int xx = 0; while(i>0) { ...
2015-11-24 14:05:27 325
原创 zoj 1558 背包
[code="C++"] #include using namespace std; int num[8],dp[10000+10]; int cmp(int x,int y) { return x>y; } int main() { int t; scanf("%d",&t); while(t--) { for...
2015-11-09 16:18:18 102
原创 poj 2985 并查集+树状数组求第k大数
[code="C++"] #include #include #define lowbit(i) i&(-i) #define maxn 300000 using namespace std; int a[maxn],c[maxn],p[maxn]; int fd(int x) { return x==p[x] ? x :fd(p[x]); } void upda...
2015-11-05 16:53:13 168
原创 hihocoder 1078 线段树区域更新
[code="C++"] #include #include #include using namespace std; #define M 1000005 struct tree{ int left,right,sum,lazy; }; tree g[M]; int map[M]; void pushDown(int i) { if(g[i].lazy) {...
2015-11-05 15:17:37 109
原创 poj 3984 bfs+栈的使用
[code="C++"] #include #include #include #include #include using namespace std; int dir[]={-1,0,1,0}; int dil[]={0,-1,0,1}; int num[6][6]; int visit[6][6]; int d[30]; struct node { ...
2015-11-03 21:01:34 166
原创 kmp裸模版 poj 3461
[code="C++"] #include #include using namespace std; const int maxn = 1000000+10; char s[maxn],t[maxn]; int next[maxn]; int m,n,k,l,i,T; void get_next(char str[]) { memset(next,0,size...
2015-11-03 19:01:13 132
原创 hdu 5510 Bazinga 思路详解 kmp +思维
[size=large]来一发代码,先前后两两比较,如果前一个串是后一个串的字串,那他就是没必要的,假设第i个串是i+1的子串,如果在后面循环比较中,如果第i+1个串是后面串的子串,那i个串就没有比的必要了,如果第i+1不是后面串的子串,直接结束循环,查找结束,得出结果[/size] [code="C++"] #include int next[10005]; int T; c...
2015-11-01 19:32:41 153
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人