fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int S( int n , int m )
  5. {
  6. if( n > m && m > 1 )
  7. {
  8. return m * S( n-1 , m ) + S( n-1 , m-1 ) ;
  9. }
  10. else
  11. return 1 ;
  12. }
  13.  
  14. int main(void)
  15. {
  16. int cases = 0 ;
  17.  
  18. scanf( "%d", &cases ) ;
  19.  
  20. for( int i = 0 ; i < cases ; i++ )
  21. {
  22. int n = 0 , m = 0 ;
  23.  
  24. scanf( "%d %d", &n , &m ) ;
  25. printf( "%d time : %lf\n", S( n , m ) % 2 , (double)clock()/CLOCKS_PER_SEC ) ;
  26. }
  27.  
  28. return 0 ;
  29. }
Success #stdin #stdout 0s 5304KB
stdin
1
4 2
stdout
1 time : 0.004177