목록Problem Solving (223)
Life Engineering
www.acmicpc.net/problem/14889 14889번: 스타트와 링크 예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다. www.acmicpc.net from itertools import combinations N=int(input()) l=[x for x in range(N)] S=[] result=int(1e9) for i in range(N): S.append(list(map(int, input().split()))) comb=list(combinations(l,N//2)) length=len(comb)//2 for i in range(length): start=0 lin..
www.acmicpc.net/problem/9205 9205번: 맥주 마시면서 걸어가기 송도에 사는 상근이와 친구들은 송도에서 열리는 펜타포트 락 페스티벌에 가려고 한다. 올해는 맥주를 마시면서 걸어가기로 했다. 출발은 상근이네 집에서 하고, 맥주 한 박스를 들고 출발한다. www.acmicpc.net from collections import deque t=int(input()) INF=int(1e9) for _ in range(t): flag=0 n=int(input()) graph=[[INF]*(n+3) for _ in range(n+3)] array=[[] for _ in range(n+3)] visited=[False]*(n+3) l=[()] for a in range(1,n+3): for b ..
www.acmicpc.net/problem/2467 2467번: 용액 첫째 줄에는 전체 용액의 수 N이 입력된다. N은 2 이상 100,000 이하의 정수이다. 둘째 줄에는 용액의 특성값을 나타내는 N개의 정수가 빈칸을 사이에 두고 오름차순으로 입력되며, 이 수들은 모두 - www.acmicpc.net n=int(input()) liquids=list(map(int, input().split())) left=0 right=2000000000 while left
www.acmicpc.net/problem/2644 2644번: 촌수계산 사람들은 1, 2, 3, …, n (1≤n≤100)의 연속된 번호로 각각 표시된다. 입력 파일의 첫째 줄에는 전체 사람의 수 n이 주어지고, 둘째 줄에는 촌수를 계산해야 하는 서로 다른 두 사람의 번호가 주어진 www.acmicpc.net n=int(input()) a,b=map(int, input().split()) graph=[[] for _ in range(n+1)] visited=[False]*(n+1) m=int(input()) result=-1 for _ in range(m): i,j=map(int, input().split()) graph[i].append(j) graph[j].append(i) def dfs(a, b,..