SHARE
TWEET

Untitled

a guest Oct 13th, 2010 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<time.h>
  3. #include<stdlib.h>
  4.  
  5. #define MAX_BINOM 90
  6.  
  7. int binoms[MAX_BINOM+1][MAX_BINOM+1];
  8.  
  9. int binom(int n, int k){
  10.         if(k==0)return 1;
  11.         if(n==0)return 0;
  12.         if(binoms[n][k]==0) binoms[n][k]=binom(n-1,k-1)+binom(n-1,k);
  13.         return binoms[n][k];
  14. }
  15. void main(){
  16.         int sorsol,i,k;
  17.         srandom(time(NULL));
  18.         sorsol=random()%43949268;
  19.         for(i=5;i>0;--i){
  20.                 for(k=0;binom(k,i)<=sorsol;++k) ;
  21.                 printf("%d\n",k);
  22.                 sorsol-=binom(k-1,i);
  23.         }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top