摘要: #include <iostream>using namespace std;bool map[4][4];bool record[4][4];//自动初始化为0;int num;void init(){int i,j;char ch;for (i=0;i<4;i++){for (j=0;j<4;j++){cin>>ch;if (ch=='+'){map[i][j]=false;}else map[i][j]=true;}}//getchar();}bool jianc(){int i,j;num=0;for (i=0;i<4;i++) 阅读全文
posted @ 2011-09-19 20:26 qijinbiao1 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <stdio.h>#include <cstring>using namespace std;struct node{ bool color; node *next[10]; node() { color=false; memset(next,NULL,sizeof(next)); }};node tre[1000050];//动态创建会超时int num;bool insert(node *root,char *str)//可行时反回true{ int data,i; bool flg1;//假设可行 阅读全文
posted @ 2011-09-19 20:23 qijinbiao1 阅读(408) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#define mx 1001using namespace std;struct treenode{char data;//结点信息int num;//记录从根到此处,结点出现的次数bool color;//从根到此处是否是关键字treenode *next[26];treenode(char c)//初始化结点{data=c;num=1;color=false;for(int i=0;i<26;i++)next[i]=NULL;}};void Insert(treenode *root,s 阅读全文
posted @ 2011-09-19 20:22 qijinbiao1 阅读(533) 评论(0) 推荐(0) 编辑
摘要: #include <string>#include <iostream>#include <algorithm>using namespace std;struct treenode{bool color;int num;treenode *next[26];treenode(){color=false;memset(next,NULL,sizeof(next));}};struct ansers{int num;string strs;};treenode tri[200001];bool cmp(ansers a,ansers b){if(a.num&g 阅读全文
posted @ 2011-09-19 20:21 qijinbiao1 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目大意:有一长为L的木板,将其分为等长的L段,从左到右编号为1~L.现将L段木板着色1. 输入"C A B C" 是将A到B这一段着成C这种颜色. 2. 输入"P A B" 是要你计算从A到B这一段有多少种不同的颜色. 我们的任务就是计算从A到B有多少种不同的颜色.(题中1<=L<=100000最多有T(30)种不同的颜色,有O(100000)个操作)解法是用线段树#include "iostream"#define Max 100000using namespace std;bool record[35];//用来记录 阅读全文
posted @ 2011-09-19 20:09 qijinbiao1 阅读(498) 评论(0) 推荐(1) 编辑