Description
Input&Output
Sample
input
2
output
2
Solution
[------------------]单峰[------------------]
除了最大值外,其他的数都有2种选择,所以答案是2^(n-1)
code
#include<cstdio>
#define mod 1000000007
#define ll long long
using namespace std;
ll n;
inline ll read()
{
ll x=0,f=0;char c=getchar();
while (c<'0' || c>'9')f=(c=='-')?1:f,c=getchar();
while (c>='0' && c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
return f?-x:x;
}
ll qpow(ll n)
{
ll ans=1,multi=2,x=n;
while(x)
{
if(x%2)ans=ans*multi%mod;
multi=multi*multi%mod;
x>>=1;
}
return ans%mod;
}
int main()
{
// scanf("%lld",&n);n--;
n=read()-1;
ll ans=qpow(n)%mod;
printf("%lld",ans%mod);
return 0;
}