#include <stdio.h> int count = 0; int Binomial(int n, int m){ count++; if( n == m || m == 0 ) return 1; else return (Binomial( n - 1, m) + Binomial( n - 1 , m - 1 )); } int main() { printf("Number:%d\n",Binomial(5,3)); printf("Count%d\n",count); return 0; }
參考資料:
http://en.wikipedia.org/wiki/Binomial_coefficient