symons

___________每一天都是幸福的!!

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

2013年3月19日

摘要: 宽搜。 1 #include <iostream> 2 #include <stdio.h> 3 #include <queue> 4 #include <string> 5 #include <string.h> 6 using namespace std; 7 int n,k; 8 int step[100000+10]; 9 void bfs(int begin)10 {11 int t,t1,t2,t3;12 queue<int>haha;13 haha.push(begin);14 step[begin]=0;1 阅读全文
posted @ 2013-03-19 12:18 symons 阅读(325) 评论(0) 推荐(0)

2013年3月18日

摘要: 这题开始自己没想出来,是看了别人的思路才明白的。 1 #include <stdio.h> 2 #include <iostream> 3 #include <math.h> 4 #include <string> 5 #include <string.h> 6 using namespace std; 7 int res,k,n; 8 bool gird[10][10]; 9 bool v_col[10];10 void dfs(int row,int number)11 {12 if(number==k)13 {14 15 res 阅读全文
posted @ 2013-03-18 21:47 symons 阅读(149) 评论(0) 推荐(0)

2013年3月15日

摘要: 写了好长(4K),一下就AC了,挺好。思路简单,写着真墨迹。 1 #include <stdio.h> 2 #include <iostream> 3 #include <string> 4 #include <string.h> 5 #define maxn 50 6 using namespace std; 7 int m,n; 8 int sx,sy,ex,ey; 9 int count[maxn][maxn]; 10 bool v[maxn][maxn]; 11 string gird[maxn]; 12 int dir[4][2]={ 阅读全文
posted @ 2013-03-15 21:17 symons 阅读(369) 评论(0) 推荐(0)

2013年3月14日

摘要: 要求字典序的顺序。 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 int n,m,cnt; 6 bool success; 7 bool sign[30][30]; 8 int step[30][2]; 9 int dir[8][2]={10 -2,-1,-2,1,11 -1,-2,-1,2,12 1 ,-2,1 ,2,13 2 ,-... 阅读全文
posted @ 2013-03-14 21:01 symons 阅读(126) 评论(0) 推荐(0)

2013年3月3日

摘要: 有两种版本,一种是c++,long long ,cin,cout, c , __int , printf(“%I64d",a);这种细节都应该注意,细节决定成败 1 #include <stdio.h> 2 #include <iostream> 3 using namespace std; 4 long long a[50+10]; 5 __int64 a[50+10]; 6 int main() 7 { 8 int i,j,n,t1,t2; 9 a[0]=1;10 a[1]=1;11 a[2]=2;12 for(i=3;i<=50... 阅读全文
posted @ 2013-03-03 00:38 symons 阅读(165) 评论(0) 推荐(0)

2013年3月2日

摘要: 这题有2个时间,分别是开始时间和结束时间,如果按照开始时间排序显然不行,那就得是按照结束时间排序了,至于为什么,就是i%^*^%$^##^#$&$。 然后还有个nowTime,排序后,如果当前时间小于开始时间的话,那么就可以观看该节目。 1 #include <stdio.h> 2 #include <iostream> 3 #include <algorithm> 4 using namespace std; 5 struct node 6 { 7 int begin,end; 8 }a[100+10]; 9 typedef struct node 阅读全文
posted @ 2013-03-02 19:34 symons 阅读(189) 评论(0) 推荐(0)

摘要: 1 /* 2 自己来写字典树 3 */ 4 #include <stdio.h> 5 #include <malloc.h> 6 #include <string.h> 7 struct node 8 { 9 int size; //该结点上的前缀单词的个数 10 struct node *child[26]; //下一个单词的结点 11 }a; 12 typedef struct node NODE; 13 NODE *root; //表示根节点。(根... 阅读全文
posted @ 2013-03-02 17:03 symons 阅读(185) 评论(0) 推荐(0)

摘要: 然后还翻看了之前AC的,一看,原来之前是用别人的模板来AC的,好无耻啊,这把是自己写的。 1 /* 2 自己来写字典树 3 */ 4 #include <stdio.h> 5 #include <malloc.h> 6 #include <string.h> 7 struct node 8 { 9 int size; //该结点上的前缀单词的个数10 struct node *child[26]; //下一个单词的结点11 }a;12 typedef struct node NODE;13 NODE *root; ... 阅读全文
posted @ 2013-03-02 16:49 symons 阅读(158) 评论(0) 推荐(0)

摘要: 将每个字符串分割,查找,如果分割后的2个字符串均存在的话输出这个字符串。墨迹了一些。 1 #include <map> 2 #include <string> 3 #include <iostream> 4 using namespace std; 5 int main() 6 { 7 string temp; 8 string a[50000+10]; 9 string t1,t2;10 int l;11 map<string,int>haha;12 int k,i,j,q,cnt=0;13 while(cin>>temp)14 . 阅读全文
posted @ 2013-03-02 12:40 symons 阅读(158) 评论(0) 推荐(0)

2013年3月1日

摘要: 刚开始用暴力方法写的,没过。然后改的小根堆。 自己用写的小根堆,没用STL。然后就是哈夫曼树。 1 /* 2 任务重了,要用小根堆来写。+哈夫曼树 3 */ 4 #include <stdio.h> 5 #include <algorithm> 6 #define maxn 20000+10 7 #define L sign*2 8 #define R sign*2+1 9 using namespace std; 10 int heap[maxn]; 11 int heapSize; 12 long long cnt; 13 bool cmp(int a,int b) 阅读全文
posted @ 2013-03-01 23:56 symons 阅读(523) 评论(0) 推荐(0)