diff options
Diffstat (limited to 'cses/IntroductoryProblems/BitStrings')
4 files changed, 9 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'; } diff --git a/cses/IntroductoryProblems/BitStrings/main_input1.txt b/cses/IntroductoryProblems/BitStrings/main_input1.txt new file mode 100644 index 0000000..c793025 --- /dev/null +++ b/cses/IntroductoryProblems/BitStrings/main_input1.txt @@ -0,0 +1 @@ +7
\ No newline at end of file diff --git a/cses/IntroductoryProblems/BitStrings/main_input2.txt b/cses/IntroductoryProblems/BitStrings/main_input2.txt new file mode 100644 index 0000000..c793025 --- /dev/null +++ b/cses/IntroductoryProblems/BitStrings/main_input2.txt @@ -0,0 +1 @@ +7
\ No newline at end of file diff --git a/cses/IntroductoryProblems/BitStrings/main_output2.txt b/cses/IntroductoryProblems/BitStrings/main_output2.txt new file mode 100644 index 0000000..b854a29 --- /dev/null +++ b/cses/IntroductoryProblems/BitStrings/main_output2.txt @@ -0,0 +1 @@ +128
\ No newline at end of file |
