전체 글
-
[백준/JAVA] 1541번: 잃어버린 괄호Algorithm 2024. 7. 18. 14:04
https://www.acmicpc.net/problem/1541 - 정답 코드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)); String input = br.readLine(); // "55-50+40" // 1. '-' 기준으로 문자열 분할 ..
-
[백준/JAVA] 16953번: A → BAlgorithm 2024. 7. 18. 10:06
https://www.acmicpc.net/problem/16953 - 정답 코드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)); StringTokenizer st = new StringTokenizer(br.readLine()); ..
-
[백준/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()); ..