#include <stdio.h>
int combi(int n, int r){
if(r==0){
return 0;
}
else if(n==r){
return 0;
}
else if(r==1){
return n;
}
else{
return combi(n-1,n-r)+combi(n-1,r);
}
}
int main(void){
int n, r;
n = 4, r = 2;
printf("C(n=%d, r=%d) = %d\n", n
, r
, combi
(n
, r
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgY29tYmkoaW50IG4sIGludCByKXsKICAgaWYocj09MCl7CiAgIHJldHVybiAwOwogICB9CiAgIGVsc2UgaWYobj09cil7CiAgIAlyZXR1cm4gMDsKICAgfQogICBlbHNlIGlmKHI9PTEpewogICAJcmV0dXJuIG47CiAgIH0KICAgZWxzZXsKICAgCXJldHVybiBjb21iaShuLTEsbi1yKStjb21iaShuLTEscik7CiAgIH0KICAgCn0KaW50IG1haW4odm9pZCl7CiAgICBpbnQgbiwgcjsKICAgIG4gPSA0LCByID0gMjsKICAgIHByaW50ZigiQyhuPSVkLCByPSVkKSA9ICVkXG4iLCBuLCByLCBjb21iaShuLCByKSk7CiAgICByZXR1cm4gMDsKfQoK