Topic Link: Collection Count
The answer is to contain at least K-at least k+1 + at least k+2 ...
Select K as the number of the intersection from N number, is C (n,k), such a set of total 2^ (2^ (n-k))-1
2^ (N-K) is the number of optional sets containing the selected K number, and the selection scheme has 2^ (2^ (n-k))-1 (cannot have an empty set or cannot guarantee k elements)
therefore Ans=c (n,k) *c (k,k) * (2^ (2^ (n-k))-1)-C (n,k+1) *c (k+1,k) *2^ (2^) (n-k-1)
No linear negation is really slow death ...
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define LL Long-long
using namespace std;
const int mod=1000000007;
const int maxn=1000010;
int fac[maxn],inv[maxn],n,k;
ll Ans=0;
int quick_pow_mod (int x,int y,int mod) {
int ret=1;
while (y) {
if (y&1) ret=1ll*ret*x%mod;
X=1ll*x*x%mod; y>>=1;
} return ret;
}
ll C (int n,int m) {return
1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
ll calc (int x) {return
C (n,x) *c (x,k)%mod* (Quick_pow_mod (2,quick_pow_mod (2,n-x,mod-1), MoD)-1)%mod;
int main () {
scanf ("%d%d", &n,&k);
Fac[0]=1;
for (int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;
Inv[0]=1;
for (int i=0;i<=n;++i) inv[i]=quick_pow_mod (fac[i],mod-2,mod);
int cur=1;
for (int i=k;i<=n;++i) {
ans+=cur*calc (i);
if (ans>=mod) ans-=mod;
else if (ans<=-mod) ans+=mod;
cur=-cur;
}
Ans%=mod;
printf ("%lld", (ans+mod)%mod);
}