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 f538bd1 commit 5b11a54Copy full SHA for 5b11a54
suyeun84/202508/08 BOJ G5 1, 2, 3 더하기 4.md
@@ -0,0 +1,28 @@
1
+```java
2
+import java.io.*;
3
+import java.util.*;
4
+
5
+public class boj15989 {
6
+ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7
+ static StringTokenizer st;
8
+ static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
9
+ static int nextInt() {return Integer.parseInt(st.nextToken());}
10
11
+ public static void main(String[] args) throws Exception {
12
+ nextLine();
13
+ int T = nextInt();
14
+ for (int tc = 0; tc < T; tc++) {
15
16
+ int n = nextInt();
17
+ int[] dp = new int[n+1];
18
+ dp[0] = 1;
19
+ for (int i = 1; i <= 3; i++) {
20
+ for (int j = i; j <= n; j++) {
21
+ dp[j] += dp[j-i];
22
+ }
23
24
+ System.out.println(dp[n]);
25
26
27
+}
28
+```
0 commit comments