From c92e40cafcb51f5d801704704b7806c21f933b6a Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Mon, 6 Oct 2025 10:13:52 +0900 Subject: [PATCH] =?UTF-8?q?[20251006]=20PGM=20/=20Lv2=20/=20=EC=9D=B4?= =?UTF-8?q?=EB=AA=A8=ED=8B=B0=EC=BD=98=20=ED=95=A0=EC=9D=B8=ED=96=89?= =?UTF-8?q?=EC=82=AC=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 --- ...40\354\235\270\355\226\211\354\202\254.md" | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 "lkhyun/202510/06 PGM Lv2 \354\235\264\353\252\250\355\213\260\354\275\230 \355\225\240\354\235\270\355\226\211\354\202\254.md" diff --git "a/lkhyun/202510/06 PGM Lv2 \354\235\264\353\252\250\355\213\260\354\275\230 \355\225\240\354\235\270\355\226\211\354\202\254.md" "b/lkhyun/202510/06 PGM Lv2 \354\235\264\353\252\250\355\213\260\354\275\230 \355\225\240\354\235\270\355\226\211\354\202\254.md" new file mode 100644 index 00000000..471f1411 --- /dev/null +++ "b/lkhyun/202510/06 PGM Lv2 \354\235\264\353\252\250\355\213\260\354\275\230 \355\225\240\354\235\270\355\226\211\354\202\254.md" @@ -0,0 +1,49 @@ +```java +class Solution { + static int maxCnt = 0; + static int maxSell = 0; + public int[] solution(int[][] users, int[] emoticons) { + saleCase(users, emoticons, 0, 0, new int[emoticons.length]); + return new int[]{maxCnt,maxSell}; + } + public void saleCase(int[][] users, int[] emoticons, int start, int count, int[] selected){ + if(count == emoticons.length){ + int curCnt = 0; + int curSell = 0; + int[] adaption = adaptSale(emoticons,selected); + for(int[] user : users){ + int userTotal = 0; + for(int i=0;i= user[0]){ + userTotal += adaption[i]; + } + } + if(userTotal >= user[1]){ + curCnt++; + }else{ + curSell += userTotal; + } + } + if(maxCnt < curCnt){ + maxCnt = curCnt; + maxSell = curSell; + }else if(maxCnt == curCnt){ + maxSell = Math.max(maxSell,curSell); + } + return; + } + + for(int i=1;i<=4;i++){ + selected[start] = i*10; + saleCase(users,emoticons,start+1,count+1,selected); + } + } + public int[] adaptSale(int[] price, int[] rate){ + int[] adaption = new int[price.length]; + for(int i=0;i