Skip to content

Commit ce4a003

Browse files
authored
Merge pull request #1656 from AlgorithmWithGod/khj20006
[20251212] BOJ / G5 / 떡파이어 / 권혁준
2 parents 21bf40b + 5e39fdc commit ce4a003

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)