소소한개발팁
반응형
article thumbnail
[완전탐색]1018번 체스판 다시칠하기
알고리즘/백준 2023. 6. 7. 19:41

출처 : https://www.acmicpc.net/problem/1018 Problem Code import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { boolean[][] arr; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.ne..

article thumbnail
[완전탐색]19352번 수학은 비대면강의입니다.
알고리즘/백준 2023. 6. 7. 16:50

출처 : https://www.acmicpc.net/problem/19352 Problem Code import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int x = 0, y = 0; int a = Integer.parseInt(st.nextToken()); int b = Intege..

article thumbnail
[완전탐색]2231번 분해합
알고리즘/백준 2023. 6. 6. 22:38

출처 : https://www.acmicpc.net/problem/2231 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 value = 0; for (int i = 0; i < N; i++) { int num = i; int sum = 0; while (num != 0) { sum += num % 10; // 각 자릿수 더하기 num /= 10; } if (sum + i == N) { value = i; break; } } System.out..

article thumbnail
[완전탐색]2798번 블랙잭
알고리즘/백준 2023. 6. 6. 22:06

출처 : https://www.acmicpc.net/problem/2798 Problem Code package baek.bruteForce; 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)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int maxValue = 0; int N = Integer.parseInt(st.nextToken()); int ..

반응형