본문 바로가기

백준8

[백준] 같이 눈사람 만들래? - 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 1939 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.List;import java.util.StringTokenizer;public class BOJ1939 { /** * N(2 ≤ N ≤ 10,000)개의 섬으로 이루어진 나라가 있다. * 서로 같은 두 섬 사이에 여러 개의 다리가 있을 수도 있으며, 모든 다리는 양방향이다. * 한 번의 이동에서 옮길 수 있는 물품들의 중량의 최댓값을 구하는 프로그램을 작성하시오. * 첫째 줄에 N, M(1 ≤ M ≤ 100,000)이 주어진다. .. 2024. 5. 11.
[백준] 합이 0인 네 정수 - Java 7453 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.StringTokenizer;public class BOJ7453 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[][] abcd = new int[N][4];.. 2024. 5. 9.
[백준] 음악프로그램 - Java 2623 간단한 위상 정렬 문제이다. import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.*;public class BOJ2623 { static int N; static int M; static List> graph; static int[] inDegree; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer .. 2024. 5. 7.