摘要:
题中先用并查集判定是否所有点都有联系,即能够拼成一个连通的无向图。 再判定入度为零的点是否为1即可。代码如下:#include <stdio.h>#include <string.h>char name[2010][50];int cnt, N, dg[2010], hash[2010], set[2010];int find( char *n ){ int i; for( i= 0; i< cnt; ++i ) { if( strcmp( n, name[i] )== 0 ) { return i; } } strcpy( name[cnt], n ); ret 阅读全文
摘要:
确定比赛名次Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3141Accepted Submission(s): 1128Problem Description有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序 阅读全文
摘要:
Repository Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 961Accepted Submission(s): 313Problem DescriptionWhen you go shopping, you can search in repository for avalible merchandises by the computers and internet. First you give the search syste 阅读全文
摘要:
T9 Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 629Accepted Submission(s): 250Problem DescriptionA while ago it was quite cumbersome to create a message for the Short Message Service (SMS) on a mobile phone. This was because you only have nine 阅读全文
摘要:
Leftmost Digit Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5395Accepted Submission(s): 2032Problem DescriptionGiven a positive integer N, you should output the leftmost digit of N^N.InputThe input contains several test cases. The first line of 阅读全文
摘要:
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3902Accepted Submission(s): 1621Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woo. 阅读全文
摘要:
排列2Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1438Accepted Submission(s): 535Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0<=数字<=9),如果四张卡片都是0,则输入结束。Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成 阅读全文
摘要:
What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 4050Accepted Submission(s): 1171Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian 阅读全文
摘要:
Flying to the MarsTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3572Accepted Submission(s): 1129Problem DescriptionIn the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . 阅读全文
摘要:
Equations Problem DescriptionConsider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0.It is consider a solution a system ( x1,x2,x3,x4 ) that verifies the equation, xi is an integer from [-100,100] and . 阅读全文