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 acfdb0c commit b06d1d7Copy full SHA for b06d1d7
Seol-JY/202510/20 BOJ G5 Ezreal 여눈부터 가네 ㅈㅈ.md
@@ -0,0 +1,23 @@
1
+```java
2
+import java.io.*;
3
+
4
+public class Main {
5
+ static final int MOD = 1_000_000_007;
6
7
+ public static void main(String[] args) throws IOException {
8
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
9
+ int N = Integer.parseInt(br.readLine());
10
11
+ long[][] dp = new long[N + 1][3];
12
+ dp[1][2] = 1;
13
14
+ for (int i = 2; i <= N; i++) {
15
+ dp[i][0] = (dp[i-1][1] + dp[i-1][2]) % MOD;
16
+ dp[i][1] = (dp[i-1][0] + dp[i-1][2]) % MOD;
17
+ dp[i][2] = (dp[i-1][0] + dp[i-1][1]) % MOD;
18
+ }
19
20
+ System.out.println(dp[N][0]);
21
22
+}
23
+```
0 commit comments