UVA 11609 Teams (组合水题)

题目链接:https://cn.vjudge.net/problem/UVA-11609

#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define read(x,y) scanf("%d%d",&x,&y)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
const int  maxn =5e4+5;
const int mod=1e9+7;
ll powmod(ll x,ll y){ll t=1;for(;y;x=x*x%mod,y>>=1) if(y&1) t=t*x%mod;return t;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*
组合水题,读懂题意就可以了,
就是n个人中任选k个人,且要令一个人为队长,
队长不同成员完全一样也算不同,问有多少种选择方法。
推公式或者直接组合思想都可以。
*/
int main()
{
    int t;scanf("%d",&t);
    for(int ca=1;ca<=t;ca++)
    {
        ll n;scanf("%lld",&n);
        printf("Case #%d: %lld\n",ca,n*powmod(2LL,n-1)%mod);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_37451344/article/details/82776381
今日推荐