diff options
Diffstat (limited to 'cses/IntroductoryProblems/BitStrings/main.cpp')
| -rwxr-xr-x | cses/IntroductoryProblems/BitStrings/main.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cses/IntroductoryProblems/BitStrings/main.cpp b/cses/IntroductoryProblems/BitStrings/main.cpp index cb4a7fb..480a9ae 100755 --- a/cses/IntroductoryProblems/BitStrings/main.cpp +++ b/cses/IntroductoryProblems/BitStrings/main.cpp @@ -1,16 +1,17 @@ -#include<bits/stdc++.h> +#include <bits/stdc++.h> using namespace std; -int main () { +int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; int m = 1e9 + 7; cin >> n; - long long ans = 0; - while(n--) { - ans += ((2 % m) * (2 % m)) % m; + n--; + long long ans = 2; + while (n--) { + ans = ((ans % m) * 2) % m; } cout << ans << '\n'; } |
