poj 1306(阶乘,大数运算)

#include<iostream>
#include<cstdio>
using namespace std;
#define ll long long 
int main(){
    ll N,M,ans,i,q;
    while(scanf("%lld%lld",&N,&M)==2&&N){
        ans = 1;
        if(N-M<M){
            q = N-M;
        }
        else{
            q = M;
        }
        for(ll i=1;i<=q;i++){
            ans = ans*(N-q+i)/i;
        }
        printf("%lld things taken %lld at a time is %lld exactly.\n",N,M,ans);
    }
    return 0;
}

 

上一篇:poj 1657(模拟,注意象的判定)


下一篇:Windows10 +TensorFlow+Faster Rcnn环境配置