We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 223b2fc commit 5e39fdcCopy full SHA for 5e39fdc
1 file changed
khj20006/202512/12 BOJ G5 떡파이어.md
@@ -0,0 +1,24 @@
1
+```cpp
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+using ll = long long;
5
+
6
+const ll MOD = 1e9 + 7;
7
8
+ll power(ll b) {
9
+ if(b == 0) return 1;
10
+ if(b == 1) return 2;
11
+ ll h = power(b>>1) % MOD;
12
+ h = (h*h)%MOD;
13
+ return (b&1) ? h * 2 % MOD : h;
14
+}
15
16
+int main(){
17
+ cin.tie(0)->sync_with_stdio(0);
18
19
+ ll N;
20
+ cin>>N;
21
+ cout<<(N == 0 ? 0 : power(N-1) % MOD);
22
23
24
+```
0 commit comments