**
航电oj:Combinations
**
#题目描述
#给你两个数,要你求出给定算式的值
#因为数据可能会很多很大,所以要减小运算过程中的中间值的大小
#知识点
大数运算
#代码
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int data[101];
int n,m;
int flag1,flag2;
int main()
{
memset(data,1,sizeof(data));
for(int i=1;i<=100;i++)
{
data[i] = i;
}
/
while(scanf("%d%d",&n,&m)!=EOF)
{
if(n==0&&m==0)
return 0;
if(n==m)//两数相同
{
printf("%d things taken %d at a time is 1 exactly.\n",n,m);
continue;
}
long long answer = 1;
int temp = n-m+1;
for(int i=1;i<=m;i++)//将算式化简后
{
answer *=temp++;
answer /=i;
}
printf("%d things taken %d at a time is %lld exactly.\n",n,m,answer);
}
return 0;
}
#总结
自己写一遍总能发现没想到的错误 (⊙﹏⊙)