2013年3月30日
摘要: sdut 2141 1 #include 2 #include 3 int mapp[110][110],vis[110],que[110],flag; 4 int k,m,t; 5 void bfs(int t) 6 { 7 int l=0,r=0,tt,j; 8 que[r++]=t; 9 while(l<r) 10 { 11 tt=que[l++]; 12 if(flag==1) 13 { 14 flag=0; ... 阅读全文
posted @ 2013-03-30 21:50 straw_berry 阅读(203) 评论(0) 推荐(0) 编辑
摘要: sdut 2107 图的深度遍历 1 #include 2 #include 3 int map[110][110], vis[110]; 4 int m, n, flag; 5 void dfs (int i) 6 { 7 int j ; 8 vis[i] = 1; 9 if( flag == 1)10 {11 printf("%d",i);12 flag = 0;13 }14 else printf(" %d",i);15 for( j=0; j<n; j++ )16 {... 阅读全文
posted @ 2013-03-30 21:38 straw_berry 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 一. 简单匹配算法先来看一个简单匹配算法的函数:int Index_BF ( char S [ ], char T [ ], int pos ){/* 若串 S 中从第pos(S 的下标0≤pos<StrLength(S))个字符起存在和串 T 相同的子串,则称匹配成功,返回第一个这样的子串在串 S 中的下标,否则返回 -1 */int i = pos, j = 0;while ( S[i+j] != '\0'&& T[j] != '\0')if ( S[i+j] == T[j] )j ++; // 继续比较后一字符else{i ++; j 阅读全文
posted @ 2013-03-30 20:20 straw_berry 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Tom's MeadowTom has a meadow in his garden. He divides it into N * M squares. Initially all the squares were covered with grass. He mowed down the grass on some of the squares and thinks the meadow is beautiful if and only if Not all squares are covered with grass.No two mowed squares are adjace 阅读全文
posted @ 2013-03-30 16:26 straw_berry 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 金牌、银牌、铜牌Time Limit: 1000MS Memory limit: 65536K题目描述Acm——大学中四大竞赛之首——是极具挑战性的大学生竞赛形式。在一场acm比赛中,一个参赛队伍由三人组合而成,在最短的时间内做出尽可能多的题目而且要尽量少提交错误代码,这样才能得到更高的排名。现在让我们模拟一次不正规的acm比赛,假设在比赛开始后30分钟(这时已经有不少同学提交了代码,在rating中已经出现),到比赛结束前,又有新的同学提交(在rating中出现),同时rating在不断变化着,还有一些同学因为一些原因中途退出比赛(这时rating中自动删除,当然在正式比赛中不会有这种情况) 阅读全文
posted @ 2013-03-30 00:24 straw_berry 阅读(415) 评论(1) 推荐(0) 编辑