The meaning of problems
There are n kinds of goods and m backpack, there are an infinite number of each article, now a number of these items into a backpack, to meet:
1, each of the backpack can not be the same kind of articles occurs (backpack allowing free);
2, all m backpack, each article have appeared.
Seeking the number of programs to 10 ^ 7 + 9 mod.
Thinking
Consider each item appears in each backpack, then for items i, there are 2 ^ m in the program, because at least then each item you want to appear in all backpack once, so the whole scheme does not appear to be subtracted, so that 2 ^ m - 1, there are n items, then it is (2 ^ m -1) ^ n
Code
#include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define ll long long const int N=200005; const int mod=1e9+7; const double eps=1e-8; const double PI = acos(-1.0); #define lowbit(x) (x&(-x)) ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);} ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;} ll inv(ll a,ll p){return qpow(a,p-2);} int main () { std::ios::sync_with_stdio(false); ll n,m; cin>>n>>m; cout<<qpow((qpow(2,m)-1+mod)%mod,n)<<endl; return 0; }