POJ 1306

其实求的这个数的式子化简一下,就是C(N,M).....

#include <iostream>
#include <algorithm>
#include <cstdio>
#define LL __int64
using namespace std; LL N,M; LL myc(LL n,LL r){
LL sum=1;
for(LL i=1;i<=r;i++)
sum=sum*(n-r+i)/i;
return sum;
} int main(){
while(scanf("%d%d",&N,&M),N||M){
LL ans=myc(N,M);
printf("%I64d things taken %I64d at a time is %I64d exactly.\n",N,M,ans);
}
return 0;
}

  

上一篇:运行Maven是报错:No goals have been specified for this build


下一篇:spring使用redis做缓存