锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品久久久久久吹潮,精品多毛少妇人妻AV免费久久
,99久久er这里只有精品18http://m.shnenglu.com/ljy1992/archive/2011/03/31/143068.htmlYinerYinerThu, 31 Mar 2011 01:21:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/31/143068.htmlhttp://m.shnenglu.com/ljy1992/comments/143068.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/31/143068.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143068.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143046.htmlYinerYinerWed, 30 Mar 2011 12:43:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143046.htmlhttp://m.shnenglu.com/ljy1992/comments/143046.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143046.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143046.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143045.htmlYinerYinerWed, 30 Mar 2011 12:38:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143045.htmlhttp://m.shnenglu.com/ljy1992/comments/143045.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143045.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143045.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143044.htmlYinerYinerWed, 30 Mar 2011 12:32:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143044.htmlhttp://m.shnenglu.com/ljy1992/comments/143044.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143044.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143044.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143004.htmlYinerYinerWed, 30 Mar 2011 03:27:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143004.htmlhttp://m.shnenglu.com/ljy1992/comments/143004.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143004.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143004.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143003.htmlYinerYinerWed, 30 Mar 2011 03:24:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143003.htmlhttp://m.shnenglu.com/ljy1992/comments/143003.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143003.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143003.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/30/143002.htmlYinerYinerWed, 30 Mar 2011 03:23:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143002.htmlhttp://m.shnenglu.com/ljy1992/comments/143002.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/30/143002.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/143002.htmlhttp://m.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://m.shnenglu.com/ljy1992/archive/2011/03/29/142976.htmlYinerYinerTue, 29 Mar 2011 15:01:00 GMThttp://m.shnenglu.com/ljy1992/archive/2011/03/29/142976.htmlhttp://m.shnenglu.com/ljy1992/comments/142976.htmlhttp://m.shnenglu.com/ljy1992/archive/2011/03/29/142976.html#Feedback0http://m.shnenglu.com/ljy1992/comments/commentRss/142976.htmlhttp://m.shnenglu.com/ljy1992/services/trackbacks/142976.html闃呰鍏ㄦ枃

]]>
国产精品免费福利久久|
精品免费久久久久久久|
久久精品无码一区二区三区|
亚洲综合精品香蕉久久网97|
日韩欧美亚洲综合久久影院d3|
久久综合噜噜激激的五月天|
好久久免费视频高清|
久久亚洲国产精品成人AV秋霞|
亚洲综合精品香蕉久久网|
亚洲国产成人久久综合野外
|
色诱久久久久综合网ywww|
97精品伊人久久久大香线蕉|
三上悠亚久久精品|
亚洲精品久久久www|
伊人伊成久久人综合网777|
狠狠色噜噜色狠狠狠综合久久|
青青青国产成人久久111网站|
99久久精品国产一区二区|
久久国产劲爆AV内射—百度|
国产精品成人精品久久久|
国产精品99久久精品|
久久综合中文字幕|
久久精品国产91久久综合麻豆自制|
久久中文字幕人妻熟av女|
久久久久亚洲AV无码麻豆|
伊人久久无码精品中文字幕|
精品国产一区二区三区久久蜜臀|
国产福利电影一区二区三区,免费久久久久久久精
|
免费观看成人久久网免费观看|
91精品国产91热久久久久福利|
久久99精品国产99久久|
久久久精品日本一区二区三区|
久久性精品|
久久精品国产精品青草app|
国内精品久久久久影院网站|
无码国产69精品久久久久网站|
久久亚洲中文字幕精品有坂深雪|
久久精品国产第一区二区|
色诱久久久久综合网ywww|
久久电影网2021|
国产精品久久久久久一区二区三区
|