From be48e14c8fc9e8c5a48d6dec06ba7518d9458ee1 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Fri, 14 Feb 2025 14:09:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Create=2014=20BOJ=20=EA=B3=A8=EB=93=9C3=20?= =?UTF-8?q?=EB=8F=99=EC=A0=84.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\223\2343 \353\217\231\354\240\204.md" | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 "lkhyun/202502/14 BOJ \352\263\250\353\223\2343 \353\217\231\354\240\204.md" diff --git "a/lkhyun/202502/14 BOJ \352\263\250\353\223\2343 \353\217\231\354\240\204.md" "b/lkhyun/202502/14 BOJ \352\263\250\353\223\2343 \353\217\231\354\240\204.md" new file mode 100644 index 00000000..f94e1dd8 --- /dev/null +++ "b/lkhyun/202502/14 BOJ \352\263\250\353\223\2343 \353\217\231\354\240\204.md" @@ -0,0 +1,46 @@ +```java +import java.util.*; +import java.io.*; +public class Main{ + public static void main(String[] args) throws Exception{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringTokenizer st = new StringTokenizer(br.readLine()); + int X = Integer.parseInt(st.nextToken()); + + int[] info = new int[4]; + int[][] dp = new int[X+1][5]; + int[] coins = {1,5,10,25}; + for(int i=0;i<4;i++){ + info[i] = Integer.parseInt(st.nextToken()); + } + for(int i=0;i<=X;i++){ + Arrays.fill(dp[i],-1); + } + for(int i=0;i<5;i++){ + dp[0][i] = 0; + } + for(int i=1;i<=X;i++){ + for(int j = 0;j<4;j++){ + if(dp[i][j]==-1){dp[i][j]=0;} + if(i-coins[j]<0){ + continue; + } + if(dp[i-coins[j]][4]>dp[i][4]){ + if(info[j] > dp[i-coins[j]][j]){ + for(int k=0;k<=4;k++){ + dp[i][k] = dp[i-coins[j]][k]; + } + dp[i][j]++; + dp[i][4]++; + } + } + } + } + for(int i=0;i<4;i++){ + bw.write(dp[X][i]+" "); + } + bw.flush(); + } +} +``` From 828263c3c2974b3e09515940c2809f85f34e290b Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Fri, 14 Feb 2025 14:12:01 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[20250214]=20BOJ=20/=20=EA=B3=A8=EB=93=9C3?= =?UTF-8?q?=20/=20=EB=8F=99=EC=A0=84=20/=20=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit