목록CSE/baekjoon & swexpert (53)
한 걸음 두 걸음
뒤에서부터 오기 ``` import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testCase = sc.nextInt(); int[] arr = new int[testCase]; for(int i = 0 ; i < testCase; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); int result = arr[arr.length-1]; int test = 0; int sum = 0; for(int i = 2; i < arr.length+1; i++) { //System.out.println("test")..
123 -> 1 2 3 -> 1+2+3 = 6 6은 3의 배수이므로 123도 3의배수입니다. 0이 하나 이상 있어야 10의 배수죠 그다음 3의 배수인지 조건을 확인하기 위해서 위를 사용합니다. import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String numStr = sc.nextLine(); int[] arr = new int[numStr.length()]; int sum = 0; for(int i = 0 ; i < numStr.length(); i++) { sum += Integer.parseInt(numStr.charAt(i)+""); ..
import java.util.*; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = 0; int pay = sc.nextInt(); int get = 1000-pay; count += get/500; get %= 500; count += get/100; get %= 100; count += get/50; get %= 50; count += get/10; get %= 10; count += get/5; get %= 5; count += get; System.out.println(count); } }

import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = 0 ; int b; char op; int count = 0; int result = 0; while(sc.hasNext()) { if(count == 0) a = sc.nextInt(); else a = result; op = sc.next().charAt(0); if(op == '=') break; b = sc.nextInt(); result = calc(a,op,b); count++; } System.out.println(result); } public ..
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] n = new int[3][4]; int[] result = new int[3]; for(int i = 0 ; i < 3; i ++) for(int j = 0 ; j < 4; j++) { n[i][j] = sc.nextInt(); result[i] += n[i][j];} for(int i = 0 ; i < 3; i ++) { switch(result[i]) { case 0: System.out.println("D"); break; case 1: System.out.print..
/* * 1 = 2 * 2 = 4 * 3 = 6 * 4 = 8 * 5 = 10 * ... * 10 = 11 * 11 = 13 * 13 = 17 * ... * 5000 = 5005 * ... * 9950 = 9973 * 9951 = 9974 * ... * 9972 = 9999 * * */ public class Main { public static void main(String[] args){ int[] arr = new int[10000];//0으로 초기화 for(int i = 1; i
백준 12096페이지의 html코드를 읽어옵니다. 주석처리된 부분을 읽어 https://www.base64decode.org/ 에서 base64코드를 입력하고 해독된 코드(한국어)를 읽어 힌트를 얻으시면 됩니다.
import java.util.Comparator; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String empty = sc.nextLine(); String[] book = new String[n]; TreeMap map = new TreeMap(); for(int i = 0 ; i < n ; i ++) {..