锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品久久久久久吹潮,精品多毛少妇人妻AV免费久久
,99久久er这里只有精品18http://www.shnenglu.com/ljy1992/archive/2011/03/31/143068.htmlYinerYinerThu, 31 Mar 2011 01:21:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/31/143068.htmlhttp://www.shnenglu.com/ljy1992/comments/143068.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/31/143068.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143068.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143068.html
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

int father[101];
bool flags[101];

struct country


{
int first;
int second;
int value;
}a[5001];

bool cmp(country x,country y)


{
return x.value<y.value;
}

int makeset(int n)


{
for(int i=1;i<=n;i++)
father[i]=i;
}

int findset(int x)


{
if(father[x]!=x)

{
father[x]=findset(father[x]);
}
return father[x];
}

int Union(int a,int b)


{
int x=findset(a);
int y=findset(b);
if(x==y)
return 1;
else

{
father[x]=y;
return 0;
}
}

int main()


{
int n,m;
while(~scanf("%d%d",&n,&m))

{
if(n==0)
break;
int sum=0;
makeset(m);
memset(flags,false,sizeof(flags));
for(int i=1;i<=n;i++)

{

scanf("%d%d%d",&a[i].first,&a[i].second,&a[i].value);

}
sort(a+1,a+n+1,cmp);


for(int i=1;i<=n;i++)

{

if(Union(a[i].first,a[i].second)==0)

{
sum=sum+a[i].value;
}
}

for(int i=1;i<=m;i++)

{
flags[findset(i)]=true;
}

int k=0;
for(int i=1;i<=m;i++)

{
if(flags[i]==true)
k++;
}

if(k!=1)
printf("?\n");
else
printf("%d\n",sum);
}
return 0;
}


]]>- 騫舵煡闆唦鏈灝忕敓鎴愭爲(wèi) HDU1233http://www.shnenglu.com/ljy1992/archive/2011/03/30/143046.htmlYinerYinerWed, 30 Mar 2011 12:43:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143046.htmlhttp://www.shnenglu.com/ljy1992/comments/143046.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143046.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143046.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143046.html
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int father[101];

void makeset(int n)


{
for(int i=1;i<=n;i++)

{
father[i]=i;
}
}
int findset(int x)


{
if(father[x]!=x)

{
father[x]=findset(father[x]);
}
return father[x];
}


int Union(int a,int b)


{
int x=findset(a);
int y=findset(b);
if(x==y)
return 1;//濡傛灉涓や釜鐐瑰湪鍚屼竴棰楁爲(wèi)涓?nbsp;閭d箞榪欎袱涓偣娣誨姞浠ュ悗浼?xì)迮炴垚鍥炶?nbsp;榪斿洖1
else

{
father[x]=y;
return 0;
}
}

struct country


{
int first;
int second;
int distance;
}a[5001];

bool cmp(country x,country y)


{
return x.distance<y.distance;
}


int main()


{
int n;
while(scanf("%d",&n)!=EOF)

{
if(n==0)
break;
makeset(n);
int sum=0;
for(int i=1;i<=n*(n-1)/2;i++)

{
scanf("%d %d %d",&a[i].first,&a[i].second,&a[i].distance);
}
sort(a+1,a+n*(n-1)/2+1,cmp);//灝嗚窛紱諱粠灝忓埌澶х殑鎺掑簭
for(int i=1;i<=n*(n-1)/2;i++)

{
if(Union(a[i].first,a[i].second)==0)//濡傛灉涓や釜鐐瑰湪鍚屼竴棰楁爲(wèi)涓?nbsp;閭d箞榪欎袱涓偣娣誨姞浠ュ悗浼?xì)迮炴垚鍥炶?nbsp;鍚﹀垯榪欎袱涓偣涔嬮棿鐨勮礬鍔犲叆鍒版渶灝忕敓鎴愭爲(wèi)涓?/span>
sum=sum+a[i].distance;
}
printf("%d\n",sum);
}
return 0;
}

]]> - 騫舵煡闆?HDU1232http://www.shnenglu.com/ljy1992/archive/2011/03/30/143045.htmlYinerYinerWed, 30 Mar 2011 12:38:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143045.htmlhttp://www.shnenglu.com/ljy1992/comments/143045.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143045.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143045.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143045.html
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

bool flags[1001];
int father[1001];

void makeset(int n)


{
for(int i=1;i<=n;i++)

{
father[i]=i;
}
}

int findset(int x)


{
if(x!=father[x])

{
father[x]=findset(father[x]);
}
return father[x];
}

void Union(int a,int b)


{
int x=findset(a);
int y=findset(b);
if(x==y)
return;
father[y]=x;
}

int main()


{
int n,m;
while(scanf("%d %d",&n,&m)!=EOF)

{
memset(flags,false,sizeof(flags));
if(n==0)
break;
makeset(n);
int first,second;
for(int i=1;i<=m;i++)

{
scanf("%d %d",&first,&second);
Union(first,second);
}
for(int i=1;i<=n;i++)//鍒ゆ柇鏍?wèi)鐨剫倝|暟

{
flags[findset(i)]=true;
}
int k=0;
for(int i=1;i<=n;i++)

{
if(flags[i]==true)
k++;
}
printf("%d\n",k-1);//闇瑕佸鍔犵殑璺暟絳変簬鏍?wèi)鐨剫倝|爲(wèi)k-1
}
return 0;
}

]]>- 騫舵煡闆?HDU1856http://www.shnenglu.com/ljy1992/archive/2011/03/30/143044.htmlYinerYinerWed, 30 Mar 2011 12:32:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143044.htmlhttp://www.shnenglu.com/ljy1992/comments/143044.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143044.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143044.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143044.html
#include<iostream>
#include<stdio.h>
using namespace std;

int father[10000001],num[10000001];



/**//*鍒濆鍖栨暟緇?/span>*/
void makeset(int x)


{
for(int i=0;i<=x;i++)

{
father[i]=i;
num[i]=1;
}
}


int findset(int x)//鏌?/span>


{
if(x!=father[x])

{
father[x]=findset(father[x]);
}//鍥炴函
return father[x];
}


void Union(int a,int b)//騫?/span>


{
int x=findset(a);
int y=findset(b);
if(x==y)

{
return;
}
if(num[x]>=num[y])

{
father[y]=x;
num[x]+=num[y];
}
else

{
father[x]=y;
num[y]+=num[x];
}
}


int main()


{ int n;

while(scanf("%d",&n)!=EOF)

{
makeset(10000000);
for(int i=1;i<=n;i++)

{
int first,second;
scanf("%d%d",&first,&second);
Union(first,second);
}
int max=-99999;
for(int i=1;i<=10000000;i++)

{
if(num[i]>max)
max=num[i];
}
printf("%d\n",max);
}
return 0;
}

]]> - 騫舵煡闆?HDU1213http://www.shnenglu.com/ljy1992/archive/2011/03/30/143004.htmlYinerYinerWed, 30 Mar 2011 03:27:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143004.htmlhttp://www.shnenglu.com/ljy1992/comments/143004.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143004.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143004.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143004.html
#include<iostream>
#include<stdio.h>
using namespace std;
int sum,n,m;
int father[50001];

void makeset(int x)


{
for(int i=1;i<=x;i++)

{
father[i]=i;
}
}

int findset(int x)//鏌?/span>


{
if(x!=father[x])

{
father[x]=findset(father[x]);
}//鍥炴函
return father[x];
}


void Union(int a,int b)


{
int x=findset(a);
int y=findset(b);
if(x==y)
return;
sum=sum-1;
father[y]=x;
}


int main()


{
int l;
scanf("%d",&l);
for(int j=1;j<=l;j++)

{ scanf("%d%d",&n,&m);
sum=n;
makeset(n);
int first,second;
for(int i=1;i<=m;i++)

{
scanf("%d%d",&first,&second);
Union(first,second);
}
printf("%d\n",sum);
getchar();
}
return 0;
}

]]> - 騫舵煡闆?POJ2524http://www.shnenglu.com/ljy1992/archive/2011/03/30/143003.htmlYinerYinerWed, 30 Mar 2011 03:24:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143003.htmlhttp://www.shnenglu.com/ljy1992/comments/143003.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143003.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143003.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143003.html宸茬煡鏈塶涓ぇ瀛︾敓錛屽叾涓湁m瀵瑰畻鏁欎俊浠扮浉鍚岀殑瀛︾敓錛岃浣犱及綆楄繖n涓鐢熶腑鏈澶氭湁澶氬皯縐嶅畻鏁欎俊浠般?
渚濇棫鏄畝鍗曠殑騫舵煡闆嗗簲鐢ㄣ傚畻鏁欎俊浠扮殑鏈澶у間負(fù)瀛︾敓鏁皀錛屽洜姝や竴寮濮嬫妸n涓鐢熶綔涓簄涓泦鍚堬紝瀵圭粰鍑虹殑姣忓澶у鐢?a 鍜?b 錛屽鏋滀粬浠湪涓嶅悓鐨勯泦鍚堬紝灝卞悎騫朵粬浠紝鐒跺悗瀹楁暀鏁板噺涓銆?榪欐渚濇棫鐢ㄥ埌浜?jiǎn)璧\寰勫帇緙╋紝鍙笉榪囦笂涓嬈″啓鐨勬槸闈為掑綊錛岃繖嬈″啓浜?jiǎn)涓涓掑綊鐗堟湰銆備篃灝辨槸鎼滅儲(chǔ)瀹屾垚鍥炴函鐨勬椂鍊?欏轟究"灝嗗綋鍓嶈妭鐐圭殑鐖惰妭鐐圭洿鎺ユ寚鍚戠鍏堣妭鐐廣?br>
棰樼洰澶ф剰瑙i噴鏉ヨ嚜Slyar Home (www.slyar.com) 杞澆璇鋒敞鏄庯紝璋㈣阿鍚堜綔銆?br>

/**//*濡傛灉涓や釜瀛︾敓鐨勪俊浠頒竴鏍?br>
鍒欐葷殑瀹楁暀涓暟鍑忎竴 */
#include<iostream>
#include<stdio.h>
using namespace std;
int sum,n,m;
int father[50001];

void makeset(int x)


{
for(int i=1;i<=x;i++)

{
father[i]=i;
}
}

int findset(int x)//鏌?/span>


{
if(x!=father[x])

{
father[x]=findset(father[x]);
}//鍥炴函
return father[x];
}


void Union(int a,int b)


{
int x=findset(a);
int y=findset(b);
if(x==y)
return;
sum=sum-1;
father[y]=x;
}


int main()


{
int l=1;
while(scanf("%d%d",&n,&m)!=EOF)

{ if(n==0&&m==0)
break;
sum=n;
makeset(n);
int first,second;
for(int i=1;i<=m;i++)

{
scanf("%d%d",&first,&second);
Union(first,second);
}
printf("Case %d: %d\n",l,sum);
l++;
}
return 0;
}


]]> - 騫舵煡闆?POJ1611http://www.shnenglu.com/ljy1992/archive/2011/03/30/143002.htmlYinerYinerWed, 30 Mar 2011 03:23:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143002.htmlhttp://www.shnenglu.com/ljy1992/comments/143002.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/30/143002.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/143002.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/143002.html
#include<iostream>
#include<stdio.h>
using namespace std;


int n,m;
int father[30001],num[30001];



/**//*鍒濆鍖栨暟緇?/span>*/
void makeset(int x)


{
for(int i=0;i<x;i++)

{
father[i]=i;
num[i]=1;
}
}


int findset(int x)//鏌?/span>


{
if(x!=father[x])

{
father[x]=findset(father[x]);
}//鍥炴函
return father[x];
}


void Union(int a,int b)//騫?/span>


{
int x=findset(a);
int y=findset(b);
if(x==y)

{
return;
}
if(num[x]>=num[y])

{
father[y]=x;
num[x]+=num[y];
}
else

{
father[x]=y;
num[y]+=num[x];
}
}


int main()


{
while(scanf("%d %d",&n,&m)!=EOF&&n!=0)

{
makeset(n);
for(int i=0;i<m;i++)

{ int l,first,b;
scanf("%d %d",&l,&first);
for(int j=1;j<l;j++)

{
scanf("%d",&b);
Union(first,b);
}
}
printf("%d\n",num[findset(0)]);//杈撳嚭0鐨勭瀹楄妭鐐圭殑縐?/span>
}
return 0;
}


]]> - 騫舵煡闆?/title>http://www.shnenglu.com/ljy1992/archive/2011/03/29/142976.htmlYinerYinerTue, 29 Mar 2011 15:01:00 GMThttp://www.shnenglu.com/ljy1992/archive/2011/03/29/142976.htmlhttp://www.shnenglu.com/ljy1992/comments/142976.htmlhttp://www.shnenglu.com/ljy1992/archive/2011/03/29/142976.html#Feedback0http://www.shnenglu.com/ljy1992/comments/commentRss/142976.htmlhttp://www.shnenglu.com/ljy1992/services/trackbacks/142976.html闃呰鍏ㄦ枃

]]>
国产成人久久精品麻豆一区|
伊人久久精品影院|
天天躁日日躁狠狠久久|
色诱久久久久综合网ywww|
久久精品人成免费|
久久久久夜夜夜精品国产|
精品无码久久久久久国产|
欧美大战日韩91综合一区婷婷久久青草|
久久婷婷五月综合97色直播|
久久精品卫校国产小美女|
久久r热这里有精品视频|
久久久久亚洲精品无码网址
|
久久亚洲精品国产精品婷婷|
91久久精一区二区三区大全|
久久精品国产精品国产精品污|
狠狠综合久久综合中文88|
亚洲va久久久噜噜噜久久|
久久久久久A亚洲欧洲AV冫|
亚洲中文久久精品无码ww16|
国产精品内射久久久久欢欢|
日日噜噜夜夜狠狠久久丁香五月|
久久久久国色AV免费看图片|
97精品伊人久久大香线蕉app|
亚洲精品乱码久久久久久蜜桃
|
伊人久久大香线蕉综合热线|
日韩AV无码久久一区二区
|
伊人久久精品无码av一区|
精品久久久久久久中文字幕|
久久久久久久尹人综合网亚洲|
午夜久久久久久禁播电影|
久久精品青青草原伊人|
久久伊人中文无码|
久久夜色撩人精品国产|
久久精品国产WWW456C0M|
精品国产热久久久福利|
97久久精品人人澡人人爽|
97久久超碰国产精品旧版|
国产精品久久久久久搜索|
99久久99久久|
国产精品日韩深夜福利久久|
久久精品人人做人人爽电影|