cses/bit-strings.cpp

23 lines
235 B
C++

#include <iostream>
int
main(void)
{
int n;
std::cin >> n;
long x = 1;
long b = 2;
while (n != 0)
{
if (n % 2 == 1)
{
x = x * b % 1000000007;
}
b = b * b % 1000000007;
n >>= 1;
}
std::cout << x << std::endl;
}