上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 99 下一页

2011年4月30日

算法小结

摘要: 最短路算法: 1.dijkstra算法 2.bellman-ford算法 3.floyd 算法 最小生成树算法: 1.prim 2.kruskal 今天搞到头晕啦。 阅读全文

posted @ 2011-04-30 19:03 more think, more gains 阅读(205) 评论(0) 推荐(0) 编辑

福大校赛B题

摘要: #include<stdio.h>#include<string.h>int main( ){ char ch[200]; char sh[101][101]; while(scanf("%s",ch)!=EOF) { int i,j,len,k,p,flag=1,flag2=0; len=strlen(ch); i=0,k=0; while(i<len) { p=0; while(ch[i]>='a'&&ch[i]<='z'||(ch[i]>='A'&& 阅读全文

posted @ 2011-04-30 14:42 more think, more gains 阅读(142) 评论(0) 推荐(0) 编辑

畅通工程续

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>const int inf=0x7fffffff;int map[210][210],N,M,dis[210],visit[210];int dij(int x,int y ){ int i,j,t,k; for(i=0;i<N;i++) { dis[i]=map[x][i]; visit[i]=0; }for(i=0;i<N;i++) { t=inf; for(j=0;j<N;j++) { if(!visit[j]&& 阅读全文

posted @ 2011-04-30 13:01 more think, more gains 阅读(114) 评论(0) 推荐(0) 编辑

hdu 1233

摘要: #include<stdio.h>#include<algorithm>using namespace std;int father[110],N,M;struct node{ int i,j,v;}T[5000];int cmp(node a,node b){ return a.v<b.v;}int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x); y=find(y); if(x!=y) father[x]=y;}in 阅读全文

posted @ 2011-04-30 11:13 more think, more gains 阅读(164) 评论(0) 推荐(0) 编辑

畅通工程 hdu 1223

摘要: #include<stdio.h>int father[1100],N,M;int find(int x){ return x==father[x]?x:father[x]=find(father[x]);}void merge(int x,int y){ x=find(x); y=find(y); if(x!=y) father[x]=y;}int main( ){ while(scanf("%d%d",&N,&M),N) { int i,j,a,b,count=1; for(i=1;i<=N;i++) father[i]=i; for( 阅读全文

posted @ 2011-04-30 11:00 more think, more gains 阅读(255) 评论(0) 推荐(0) 编辑

上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 99 下一页

导航