摘要:
题意:给定一张图,求从1到n+1的最长距离。bfs即可,没什么技巧。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 #include<queue> 6 #include<stack> 7 using namespace std; 8 const int maxn = 105; 9 const int maxm = 10000; 10 const int inf = 99999999 阅读全文
posted @ 2013-02-26 23:20
xxx0624
阅读(524)
评论(3)
推荐(0)
摘要:
1219 水~View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 30; 4 int a[ maxn ]; 5 char s[ 100005 ]; 6 int main(){ 7 while( gets( s )!=NULL ){ 8 memset( a,0,sizeof( a ) ); 9 int len=strlen( s );10 for( int i=0;i<len;i++ ){11 if( s[i]>='a'&&s[... 阅读全文
posted @ 2013-02-26 18:48
xxx0624
阅读(572)
评论(0)
推荐(0)
摘要:
题意:给定一张图,从1到n,若能随便去除一条路,问最短路?注意:两点可能存在多条路,这时 事实上只要保存下第一短和第二短的,然后在枚举的时候每次去除一条换上第二短的路。。。。。这样最后就能得到ans。(若存在某种方法使得1不能到n,则break,print -1 )View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 阅读全文
posted @ 2013-02-26 14:42
xxx0624
阅读(534)
评论(0)
推荐(0)