题目:
https://ac.nowcoder.com/acm/contest/17345/D
思路:
或者是说倒序相加
1Cn1+2Cn2+3Cn3+....(n-1)cn(n-1)+nCnn
nCnn+(n-1)Cnn-1+...................1Cn1
ans=[n*(2^n-1)+n]/2;
ans=n*(2^(n-1))
快速幂来求
#include<stdio.h>
const int maxn=1000000007;
int main()
{
long long ans=1;
int n;
scanf("%d",&n);
long long b=n-1,a=2;
while(b)
{
if(b&1)
ans=(ans*a)%maxn;
a=(a*a)%maxn;
b>>=1;
}
ans*=n;
if(ans>maxn)
ans%=maxn;
printf("%lld",ans);
}