1 solutions

  • 0
    @ 2022-2-10 9:47:05

    #include<bits/stdc++.h> using namespace std;

    typedef long long ll;

    ll mod = 1000000007;

    ll quick_pow(ll a, ll b, ll p) {//快速幂求2^n-1

    ll ans = 1;
    while (b) {
    	if (b & 1) ans = (ans * a) % p;
    	a = (a * a) % p;
    	b >>= 1;
    }
    return ans;
    

    }//考察了一点二项式定理

    int main() {//答案为1cn1+2cn2+3cn3+....ncnn,合并成ans下面的公式

    ll n;
    cin >> n;
    ll ans = n*quick_pow(2, n - 1, mod)%mod;//ans=n*2^n-1
    cout << ans;
    return 0;
    

    }

    • 1

    Information

    ID
    1544
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    24
    Accepted
    14
    Uploaded By