Algorithm
-
[백준/JAVA] 13305번: 블로그2Algorithm 2024. 7. 17. 17:14
https://www.acmicpc.net/problem/20365 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;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()); // 문자 수 String colors = br.readLine(); // BB..
-
[백준/JAVA] 13305번: 주유소Algorithm 2024. 7. 17. 15:20
https://www.acmicpc.net/problem/13305 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;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()); // 도시 개수 Str..
-
[백준/JAVA] 20300번: 서강근육맨Algorithm 2024. 7. 17. 10:12
https://www.acmicpc.net/problem/20300 - 정답 코드import java.util.Arrays;import java.util.Scanner;public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[] list = new long[N]; for(int i = 0; i - 문제 풀이입력 값의 제한 조건에서 t_i가 최대 10^18까지 가능하다고 했기 때문에 long을 사용 1. 운동기구의 개수가 짝수인 경우 if(N % 2 == 0) { f..
-
[백준/JAVA] 11399번: ATMAlgorithm 2024. 7. 17. 09:36
https://www.acmicpc.net/problem/11399 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.StringTokenizer;// 걸리는 시간에 따라 오름차순 정렬 public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Intege..
-
[백준/JAVA] 11508번: 2+1 세일Algorithm 2024. 7. 16. 17:41
https://www.acmicpc.net/problem/11508 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.Collections;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());..
-
[백준/JAVA] 1758번: 알바생 강호Algorithm 2024. 7. 16. 16:25
https://www.acmicpc.net/problem/1758 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.Collections;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()); ..
-
[백준/JAVA] 2217번: 로프Algorithm 2024. 7. 16. 15:32
https://www.acmicpc.net/problem/2217 - 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;public class Main { // 10 10 가능 // 10 15 -> 하나당 감당 무게 25 / 2 = 12 ---> 불가 // 15 15 불가 public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ..
-
[백준/JAVA] 1343번: 폴리오미노Algorithm 2024. 7. 16. 14:21
- 정답 코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main { static String[] list; static int count = 0; public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String board = br.readLine(); // XXXXXX StringBuilder result = new StringB..