Codeforces Round #593 (Div. 2) B. Alice and the List of Presents

题目:https://codeforces.com/contest/1236/problem/B
思路:构造
有n个present,m个box
presentn 可以放在 box1,box2,box3,......,box1 and box2,box1 and box3,boxand box3,......,boxand boxand box3,......  总共 $2^{m-1}$ 种分法
根据乘法原理 n 个present 共有 ${2^{m-1}}^n$ 种分法 

#include 
 
using namespace std;
 
typedef long long ll;
 
const ll mod=1e9+7;
 
int n,m;
 
ll ksm(ll n,ll x)
{
    ll res=1;
    while(x)
    {
        if(x&1) res=res*n%mod;
        n=n*n%mod;
        x>>=1;
    }
    return res;
}
int main()
{
    cin>>n>>m;
    cout<2,m)+mod-1)%mod,n);
    return 0;
}

你可能感兴趣的:(Codeforces Round #593 (Div. 2) B. Alice and the List of Presents)