文章分类 - 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
阅读全文
摘要:#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( "%
阅读全文