摘要: /*线段树更新节点,区间最值*/#include <stdio.h> #include <stdlib.h>const int MAXN = 200001;int MAX(int x, int y){ return x > y ? x : y;}struct segTree{ int L,R; int max;};segTree tree[MAXN << 2];int st[MAXN];void bulid(int left,int right, int t){ tree[t].L = left; tree[t].R = right; if( left 阅读全文
posted @ 2011-04-10 22:45 L.. 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"ctype.h"#include"string.h"#include"stdlib.h"int n,max = -1,maxI;char str[80],telNum[100000][9];char map[27] = "22233344455566677778889999";int cmp(const void *a,const void *b){ return (strcmp((char*)a,(char*)b));}void toNum( 阅读全文
posted @ 2011-04-10 06:40 L.. 阅读(109) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"string.h"char str[10000];void print(){ scanf("%s",str); int i = 0,len = strlen(str),k; char c ; while(i < len){ c = str[i]; k = i; while(str[++i] == c){ } if(i - k > 1) printf("%d%c",i - k,c); else printf("%c",c); } pr 阅读全文
posted @ 2011-04-10 06:36 L.. 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"int b[1000];int f[1000];int main(){ //freopen("in.txt","r",stdin); int n,i,j,temp;//temp 存最大的f[i] while(scanf("%d",&n),n){ for(i = 0; i < n; i++){ scanf("%d",&b[i]); f[0] = b[0];//第一个数 temp = -1; for(j = 0; j < i; j++){ 阅读全文
posted @ 2011-04-10 06:24 L.. 阅读(105) 评论(0) 推荐(0) 编辑
摘要: //最基础的并查集 最小生成树 #include <stdio.h>#include <stdlib.h> const int MAX = 101;struct E{ int x,y,weight;};E edge[5001];int father[MAX];int cmp(const void *d1, const void *d2){ return (*(E*)d1).weight - (*(E*)d2).weight;}void makeSet(int n){ for(int i = 0; i <= n; i++) father[i] = i;}int fi 阅读全文
posted @ 2011-04-10 06:20 L.. 阅读(117) 评论(0) 推荐(0) 编辑
摘要: /*状态转移方程MAXLEN = max{MAXLEN(area[i-1][j]),MAXLEN(area[i+1][j],MAXLEN(area[i][j+1])),MANLEN(area[i][j-1]) | area[i][j] > ..} + 1 */#include"stdio.h"#include"string.h"int row,col,area[110][110];int f[110][110];int max,i,j;void in(){ scanf("%d%d",&row,&col); for 阅读全文
posted @ 2011-04-10 06:17 L.. 阅读(150) 评论(0) 推荐(0) 编辑
摘要: /*并查集!最后判断有几个父亲就是答案了*/#include <iostream>#include <set>using namespace std;struct G{ int left; int right; int up; int down;};const int MAXN = 50;int father[MAXN * MAXN]; int m,n;G g[11] = {{1,0,1,0},{0,1,1,0},{1,0,0,1},{0,1,0,1},{0,0,1,1},{1,1,0,0},{1,1,1,0},{1,0,1,1},{1,1,0,1},{0,1,1,1} 阅读全文
posted @ 2011-04-10 06:15 L.. 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 这种处理日期的方法很值得学习!很巧妙!#include <stdio.h>int year[2] = {365, 366}; //0 非润年int month[2][12] = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}}; //0 非润年的月份//2000年1月1日 Saturday char week[7][10]={"Saturday","Sunday","Monday","Tuesday" 阅读全文
posted @ 2011-04-10 06:01 L.. 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>char haabMonth[19][10] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", 阅读全文
posted @ 2011-04-10 05:40 L.. 阅读(139) 评论(0) 推荐(1) 编辑
摘要: #include <iostream>#include <algorithm>#include <stack>#define L(x) ((x) << 1)#define R(x) ((x) << 1 | 1)using namespace std;const int MAXN = 50000;struct SegTree{ int l, r; int mval, lval, rval; int cover; //1 没坏 0 坏 -1 有的坏了 有的没坏 void init(int c){ lval = rval = mval = 阅读全文
posted @ 2011-04-10 05:37 L.. 阅读(377) 评论(0) 推荐(1) 编辑