include stdio int cnk int int long long res if for int res res return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
int cnk(int k, int n)
{
long long res = 1;
if (k > n - k) k = n - k;
for(int i = 1; i <= k; i++)
res = res * (n - i + 1) / i;
return (int)res;
}
int main(void)
{
int n, k;
while(scanf("%d %d",&n,&k),n,k)
printf("%d\n",cnk(k,n));
return 0;
}