BZOJ4475 [Jsoi2015]子集选取

一看题,妈呀不会啊,找找规律吧,打表好麻烦啊,前两天xuruifan看代码长度猜出了题意,要不我看样例猜规律吧,一看根子集有关,果断2^n,2^2=4?样例得16?再来个^k

交一发,过了-_-

#include<cstdio>
using namespace std;
#define MOD 1000000007
#define ll long long
ll mi(ll x,ll y)
{
    ll re=1;
    while(y)
    {
        if(y&1)(re*=x)%=MOD;
        (x*=x)%=MOD;
        y>>=1;
    }
    return re;
}
ll n,k;
int main(){
    scanf("%lld%lld",&n,&k);
    printf("%lld\n",mi(mi(2,n),k));
    return 0;
}


你可能感兴趣的:(BZOJ4475 [Jsoi2015]子集选取)