版权声明:~~~感谢支持! https://blog.csdn.net/qq_39897867/article/details/88368264
题目
解题思路
可以发现,峰顶一定是 n,因此考虑 分别放在 的左边还是右边,得出相应的唯一答案。所以答案就是
代码
#include<cstdio>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;
const ll ymw=1e9+7;
ll n;
ll ksm(ll x,ll y){
ll p=1;
for (;y;y>>=1,(x*=x)%=ymw) if (y&1) (p*=x)%=ymw;
return p;
}
int main(){
scanf("%lld",&n);
printf("%lld",ksm(2,n-1));
}