목록Problem Solving (223)
Life Engineering
www.acmicpc.net/problem/1389 1389번: 케빈 베이컨의 6단계 법칙 첫째 줄에 유저의 수 N (2 ≤ N ≤ 100)과 친구 관계의 수 M (1 ≤ M ≤ 5,000)이 주어진다. 둘째 줄부터 M개의 줄에는 친구 관계가 주어진다. 친구 관계는 A와 B로 이루어져 있으며, A와 B가 친구라는 뜻 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 from collections import deque N, M=map(int, input().split()) graph=[set() for _ in range(N+1)] visited=[False]*(N+1) ..
www.acmicpc.net/problem/1931 1931번: 회의실 배정 (1,4), (5,7), (8,11), (12,14) 를 이용할 수 있다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 N=int(input()) array=[] count=1 for i in range(N): start, end=map(int, input().split()) array.append((start,end)) array.sort(key=lambda x: (x[1], x[0])) meeting=array[0] for i in range(1,len(array)): if meeting[1]
www.acmicpc.net/problem/6603 6603번: 로또 입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있다. 첫 번째 수는 k (6 < k < 13)이고, 다음 k개 수는 집합 S에 포함되는 수이다. S의 원소는 오름차순으로 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 array=[] visited=[False]*13 while True: l=list(map(int, input().split())) if l[0]!=0: array.append(l) else: break def dfs(i, start, count): if count==6: for j ..
SET 1~4 https://www.acmicpc.net/workbook/view/2418 1-1. 탐색과 정렬 (1) A – 1920 수 찾기 https://www.acmicpc.net/problem/1920 B – 2750 수 정렬하기 https://www.acmicpc.net/problem/2750 C – 2751 수 정렬하기 2 https://www.acmicpc.net/problem/2751 D – 10989 수 정렬하기 3 https://www.acmicpc.net/problem/10989 E – 10815 숫자 카드 https://www.acmicpc.net/problem/10815 문제를 풀기 전에 공부하기: 이진 탐색, O(nlgn) 정렬, 카운팅 정렬 학습 유의사항: 이분 탐색과 정렬을..