文章分类 -  ACM

摘要:Joseph's ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5789Accepted: 1436DescriptionJoseph likes taking part in programming contests. His favorite problem is, of course, Joseph's problem.It is stated as follows.There are n persons numbered from 0 to n - 1 standing in a circ 阅读全文
posted @ 2011-07-23 15:33 贺佐安 阅读(1513) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> int set[ 1024 ]; int find( int i ) { return set[ i ] == i ? i : set[ i ] = find( set[ i ] ); } void merge( int x, int y ) { int a = find( x ),b = find( y ); set[ a ] = b; } int main( ) { int n,m,a,b; while( scanf( "%d",&n ) != EOF && n ) { scanf( "% 阅读全文
posted @ 2011-03-29 21:27 贺佐安 阅读(156) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示