poj2249
简单题
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int com(int n, int r)
{
if (n - r < r)
r = n - r;
int i , j;
long long s = 1;
for (i = 0, j = 1; i < r; i++)
{
s *=(n - i);
for (; j <= r && s % j == 0; j++)
s /= j;
}
return (int)s;
}
int main()
{
//freopen("t.txt", "r", stdin);
int n, k;
while (scanf("%d%d", &n, &k), n | k)
printf("%d\n", com(n, k));
return 0;
}