From 8bf251634bc9e84d73fca2f98a0f386704095263 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Sat, 20 Sep 2025 17:25:56 +0900 Subject: [PATCH] =?UTF-8?q?[20250920]=20BOJ=20/=20G4=20/=20=EB=A1=9C?= =?UTF-8?q?=EB=98=90=20/=20=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20 BOJ \353\241\234\353\230\220.md" | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 "0224LJH/202509/20 BOJ \353\241\234\353\230\220.md" diff --git "a/0224LJH/202509/20 BOJ \353\241\234\353\230\220.md" "b/0224LJH/202509/20 BOJ \353\241\234\353\230\220.md" new file mode 100644 index 00000000..c9bad4ff --- /dev/null +++ "b/0224LJH/202509/20 BOJ \353\241\234\353\230\220.md" @@ -0,0 +1,65 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + +public class Main { + + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + static int[] arr; + static long[][] dp; + static int numCnt, max; + static long ans; + + public static void main(String[] args) throws NumberFormatException, IOException { + int TC = Integer.parseInt(br.readLine()); + for (int tc =1; tc <= TC; tc++) { + init(); + process(); + print(); + } + + } + + public static void init() throws NumberFormatException, IOException { + StringTokenizer st = new StringTokenizer(br.readLine()); + numCnt = Integer.parseInt(st.nextToken()); + max = Integer.parseInt(st.nextToken()); + arr = new int[numCnt]; + dp = new long[numCnt][max+1]; + ans = 0; + } + + public static void process() { + Arrays.fill(dp[numCnt-1], 1); + for (int i = numCnt-1; i > 0; i--) { + for (int j = max; j >=0; j--) { + dp[i-1][j/2] += dp[i][j]; + } + for (int j = max; j > 0; j--) { + dp[i-1][j-1] += dp[i-1][j]; + } + } + + for (int i = 0; i < numCnt; i++) { + for (int j = 0; j <= max; j++) { + System.out.print (dp[i][j]+ " "); + } + System.out.println(); + } + for (int i = 1; i <= max; i++) { + + ans += dp[0][i]; + } + + } + + + + public static void print() { + System.out.println(ans); + } +} +```