From cf29f638a16df11e9db3b0e886fdd2195ceea76c Mon Sep 17 00:00:00 2001 From: j2woo Date: Wed, 22 Mar 2023 14:22:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EB=B0=95=EC=A7=80=EC=9A=B0:=20=EA=B0=80?= =?UTF-8?q?=EC=9E=A5=20=ED=81=B0=20=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\236\245\355\201\260\354\210\230.java" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "j2woo/week3/\352\260\200\354\236\245\355\201\260\354\210\230.java" diff --git "a/j2woo/week3/\352\260\200\354\236\245\355\201\260\354\210\230.java" "b/j2woo/week3/\352\260\200\354\236\245\355\201\260\354\210\230.java" new file mode 100644 index 0000000..e62e14f --- /dev/null +++ "b/j2woo/week3/\352\260\200\354\236\245\355\201\260\354\210\230.java" @@ -0,0 +1,26 @@ +package j2woo.week3; +import java.util.*; +public class 가장큰수 { + class Solution { + public String solution(int[] numbers) { + String answer = ""; + String numString[] =new String[numbers.length]; + for(int i=0;i String 배열로 변환, 이유는 String으로 정렬하여 큰 수 비교하기 위해 + numString[i]=Integer.toString(numbers[i]); + } + Arrays.sort(numString,new Comparator<>(){ + // 내림차순 정렬 + @Override + public int compare(String o1, String o2){ // string형 배열이면 sort(A)는 UTF-16 문자 인코딩 체계의 코드 순서에 따라 요소를 정렬한다. + return (o2+o1).compareTo(o1+o2); // {6, 10, 2}-> {6, 2, 10} + } + }); + answer=String.join(answer,numString); // 문자열 배열 이어붙이기 + // 숫자가 다 0일 때 + if(numString[0].equals("0")){ + answer="0"; + } + return answer; + } + } +} From 49f11d778f02e0d906219d673417882625ddc127 Mon Sep 17 00:00:00 2001 From: j2woo Date: Tue, 28 Mar 2023 23:44:38 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EB=B0=95=EC=A7=80=EC=9A=B0:=20=ED=87=B4?= =?UTF-8?q?=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "j2woo/week4/\355\207\264\354\202\254.java" | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "j2woo/week4/\355\207\264\354\202\254.java" diff --git "a/j2woo/week4/\355\207\264\354\202\254.java" "b/j2woo/week4/\355\207\264\354\202\254.java" new file mode 100644 index 0000000..ef17530 --- /dev/null +++ "b/j2woo/week4/\355\207\264\354\202\254.java" @@ -0,0 +1,34 @@ +package j2woo.week4; +import java.io.*; +import java.util.*; +public class 퇴사 { + public static void main(String[] args) throws IOException{ + BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st=new StringTokenizer(br.readLine()); + + int N=Integer.parseInt(st.nextToken()); // 퇴사 전까지 남은 N일 + // 상담 일정표 plan[i][0]: i일 상담의 걸리는 기간 T, plan[i][1]: i일 상담의 금액 P + int [][] plan=new int[N+1][2]; // 1일부터 N일까지 확인위해 N+1 + for(int i=1; i