|
Post by huangno1 on Mar 3, 2017 6:45:24 GMT -8
int main()
{
int N , M , K ;
int i = 0 , j = 0 , x = 0 ;
char f[ 1000000 ] = {} , end[ 1000000 ] = {} ; int aa = 0 ;
scanf ( " %d %d %d" , &N , &M , &K ) ;
for ( i = 0 ; i < N ; i ++ )
f[ i ] = '1' + i ;
i = M - 1 ;
if ( ( i + 1 ) + ( M - 1 ) > N )
i = ( i - 1 ) + ( M - 1 ) - N ;
for ( i = M - 1 ; i < N ; i += ( M - 1 ) )
{
printf ( "i = %d\n" , i ) ;
f[ i ] = '0' ;
K -- ;
for ( j = 0 ; j < N ; j ++){
if ( isdigit( f [ j ] ) && f [ j ] > '0' )
{
end [ x ] = f [ j ] ;
x ++ ;
}
}
x = 0 ;
N -- ;
strcpy( f , end ) ;
if ( ( i + 1 ) + ( M - 1 ) > N )
i = ( i - 1 ) + ( M - 1 ) - N ;
if ( K == 0 )
break ;
}
printf ( "%c" , f[ i ] ) ;
return 0 ;
}
|
|