We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a9abc5 commit 1b751daCopy full SHA for 1b751da
15000/15717/15717.cpp
@@ -0,0 +1,31 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+
4
+typedef long long ll;
5
6
+ll n;
7
+int mod = 1000000007;
8
9
+int main() {
10
+ ios::sync_with_stdio(false); cin.tie(NULL);
11
+ cin>>n;
12
+ --n;
13
14
+ ll ans = 1, cur = 2;
15
+ if(n == 0){
16
+ ans = 1;
17
+ }
18
19
+ while(n > 0){
20
+ if(n % 2) {
21
+ ans = (ans*cur) % mod;
22
+ n--;
23
+ }else {
24
+ n /= 2;
25
+ cur = (cur*cur) % mod;
26
27
28
29
+ cout<<ans<<"\n";
30
+ return 0;
31
+}
0 commit comments