Skip to content

Commit f5b8a7a

Browse files
authored
Merge pull request #1437 from AlgorithmWithGod/khj20006
[20251117] BOJ / G5 / 비요뜨의 징검다리 건너기 / 권혁준
2 parents 376939f + 2bdcc6b commit f5b8a7a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```cpp
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
using ll = long long;
5+
6+
ll MOD = 1e9 + 7;
7+
8+
ll power(ll a) {
9+
if (a <= 1) return (1 << a);
10+
ll h = power(a >> 1) % MOD;
11+
h = h * h % MOD;
12+
return (a & 1) ? h * 2 % MOD : h;
13+
}
14+
15+
int main() {
16+
cin.tie(0)->sync_with_stdio(0);
17+
18+
ll T, N, MOD = 1e9 + 7;
19+
for (cin >> T; T--;) {
20+
cin >> N;
21+
cout << (N <= 2 ? 1 : power(N - 2)) << '\n';
22+
}
23+
24+
}
25+
```

0 commit comments

Comments
 (0)