POJ 1306 Combinations

时间:2023-03-10 03:19:05
POJ 1306 Combinations
// 求 C[n][m]
// 组合公式 C[i][j]=C[i-1][j-1]+C[i-1][j];
#include <iostream>
#include <string>
#include<sstream>
#include <cmath>
#include <map>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define LL long long
LL C[][];
int main()
{
int i,j;
for(i=;i<=;i++) C[i][]=;
for(i=;i<=;i++)
for(j=;j<=i;j++)
C[i][j]=C[i-][j-]+C[i-][j];
int n,k;
while(scanf("%d %d",&n,&k),n|k)
{
printf("%d things taken %d at a time is %lld exactly.\n",n,k,C[n][k]);
}
return ;
}