ACM UVA-530

組合數

int n,m;
unsigned long long combination(){
    unsigned long long p = 1;
    if(m>(n/2)){
        m = n-m;
    }
    for(int i = 1;i <= m;i = i+1){
       p = p*(n-i+1)/i;
    }
    return p;
}
int main(int argc, char const* argv[])
{
    while(~scanf("%d %d",&n,&m) && !(n == 0 && m == 0)){
        printf("%llu\n",combination());
    }
    return 0;
}