题意:求长度为n,只包含0,1的所有序列中,子序列10的总数。
思路:在序列中找任意两个位置放上10,其他位置为0或1对计数无影响。所以只需输出图片说明
代码:

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll pw(ll a)
{
    ll s=1,t=2;
    while(a){
        if(a&1) s=(s*t)%mod;
        t=(t*t)%mod;
        a>>=1;
    }
    return s;
}
int main()
{
    ll n;
    cin>>n;
    cout<<((((n%mod)*((n-1)%mod)/2)%mod)*pw(n-2))%mod<<endl;
    return 0;
}