소소한개발팁
반응형
article thumbnail
[정렬]10989번 수 정렬하기3
알고리즘/백준 2023. 6. 14. 23:27

출처 : https://www.acmicpc.net/problem/10989 Problem Code import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] Nl = new int[N]; for (int i = 0; i < N; i++) Nl[i] = Integer.parseInt(br.readLine()); Arrays.sort(Nl); ..

article thumbnail
[정렬]2751번 수 정렬하기2
알고리즘/백준 2023. 6. 13. 22:38

출처 : https://www.acmicpc.net/problem/2751 Problem Code import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int N = Integer.parseInt(br.readLine()); ArrayList list = new ArrayList(); for (int i = 0; i < N; i++) list.add..

article thumbnail
[정렬]2587번 대표값2
알고리즘/백준 2023. 6. 12. 22:56

출처 : https://www.acmicpc.net/problem/2587 Problem Code import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] Nl = new int[5]; int count = 0; for (int i = 0; i < 5; i++) { int N = sc.nextInt(); count += N; Nl[i] = N; } Arrays.sort(Nl); StringBuilder sb = new StringBuilder(); sb.append(count / 5 + ..

article thumbnail
[정렬]2750번 수 정렬하기
알고리즘/백준 2023. 6. 11. 23:56

출처 : https://www.acmicpc.net/problem/2750 Problem Code import java.io.*; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] nList = new int[N]; for (int i = 0; i < nList.length; i++) nList[i] = Integer.parseInt(br.readLine(..

article thumbnail
[완전 탐색] 2839번 설탕배달
알고리즘/백준 2023. 6. 8. 18:20

출처 : https://www.acmicpc.net/problem/2839 Problem Code package baek.bruteForce; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); // 3 , 5 int a = 3; int b = 5; int value = 0; if (N == 4 || N == 7) { value = -1; // 3 , 5로 나누어 떨어지지 않는 수 } else { int remainder = N % b; if (remainder == 0) { ..

article thumbnail
[완전탐색]1436번 영화감독
알고리즘/백준 2023. 6. 8. 17:50

출처 : https://www.acmicpc.net/problem/1436 Problem Code import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); int num = 666; int cnt = 1; while (cnt != N) { num++; if (String.valueOf(num).contains("666")) cnt++; } System.out.println(num); } } 순회하면서 666이 포함될때마다 카운트를 하도록 했습니다.

반응형