其他分享
首页 > 其他分享> > poj 1306(阶乘,大数运算)

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;
}

 

标签:std,1306,ll,long,poj,ans,阶乘,include
来源: https://www.cnblogs.com/stevenzrx/p/15074603.html