본문 바로가기

PS23

[goorm] Dead Or Arrive - Java import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.StringTokenizer;public class DeadOrArrive { static class Car{ int v; int w; int number; public Car(int v, int w, int number){ this.v = v; this.w = w; this.number = number; } } public static .. 2024. 5. 21.
[백준] 구간 나누기2 - Python 13397 # 8 3# 1 5 4 6 2 1 3 7# [1, 1, 2, 3, 4, 5, 6, 7]import sysinput = sys.stdin.readlinedef check(target): global arr, M now_min = now_max = arr[0] count = 1 for i in range(len(arr)): now_min = min(now_min, arr[i]) now_max = max(now_max, arr[i]) if now_max - now_min > target: count += 1 now_max = now_min = arr[i] # print("count", count, targe.. 2024. 5. 19.
[백준] 같이 눈사람 만들래? - Python 20366 # 5# 3 5 2 5 9## 2 3 5 5 9#import sysinput = sys.stdin.readlineT = int(input().rstrip())nums = list(map(int, input().split()))nums.sort()result = sys.maxsizefor i in range(len(nums)): for j in range(i + 3, len(nums)): l = i + 1 r = j - 1 while l abs(temp): result = abs(temp) if temp 2024. 5. 15.
[백준] 말이 되고픈 원숭이 - Java 1600 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.LinkedList;import java.util.Queue;import java.util.StringTokenizer;public class Main { /** * 입력) * 1 * 4 4 * 0 0 0 0 * 1 0 0 0 * 0 0 1 0 * 0 1 0 0 * * 출력) * 4 */ static int N; static int M; static int K; static int[][] grid; stat.. 2024. 5. 14.