본문 바로가기
반응형

전체 글573

[다이나믹 프로그래밍] 백준 7579번 : 앱 / 골드 3 https://www.acmicpc.net/problem/7579 7579번: 앱 입력은 3줄로 이루어져 있다. 첫 줄에는 정수 N과 M이 공백문자로 구분되어 주어지며, 둘째 줄과 셋째 줄에는 각각 N개의 정수가 공백문자로 구분되어 주어진다. 둘째 줄의 N개의 정수는 현재 활 www.acmicpc.net import sys input = sys.stdin.readline n, capacity = map(int, input().split()) byte = list(map(int, input().split())) cost = list(map(int, input().split())) max_cost = sum(cost) dp = [[0]*(max_cost+1) for _ in range(n+1)] for i .. 2021. 8. 22.
[누적합] 백준 2143번: 두 배열의 합 / 골드 3 https://www.acmicpc.net/problem/2143 2143번: 두 배열의 합 첫째 줄에 T(-1,000,000,000 ≤ T ≤ 1,000,000,000)가 주어진다. 다음 줄에는 n(1 ≤ n ≤ 1,000)이 주어지고, 그 다음 줄에 n개의 정수로 A[1], …, A[n]이 주어진다. 다음 줄에는 m(1 ≤ m ≤ 1,000)이 주어지고, 그 www.acmicpc.net import collections import sys input = sys.stdin.readline t = int(input()) n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split()).. 2021. 8. 22.
[오일러 경로] 백준 16168번: 퍼레이드 / 골드 4 https://www.acmicpc.net/problem/16168 16168번: 퍼레이드 첫 번째 줄에 지점의 개수 V, 연결 구간의 개수 E가 주어진다. (1 ≤ V ≤ E ≤ 3000) 이후 E개의 줄에 걸쳐 각 연결 구간이 연결하는 두 지점의 번호 Va, Vb가 공백을 사이에 두고 주어진다. (1 ≤ Va, www.acmicpc.net import collections import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) v, e = map(int, input().split()) adj = [0 for i in range(v)] visited = [False for i in range(v)] graph = collections.de.. 2021. 8. 22.
[기하학/파이썬] 백준 2527번: 직사각형 / 실버 1 https://www.acmicpc.net/problem/2527 2527번: 직사각형 4개의 줄로 이루어져 있다. 각 줄에는 8개의 정수가 하나의 공백을 두고 나타나는데, 첫 4개의 정수는 첫 번째 직사각형을, 나머지 4개의 정수는 두 번째 직사각형을 각각 나타낸다. 단 입력 직 www.acmicpc.net import sys input = sys.stdin.readline for i in range(4): x1, y1, x2, y2, x3, y3, x4, y4 = map(int, input().split()) if x3 > x2 or x4 y2 or y4 < y1: print('d') continue if [x1, y1] == [x4, y4] or [x2, y1]==[x3, y.. 2021. 8. 21.
[유니온-파인드] 백준 3108번: 로고 / 골드 3 https://www.acmicpc.net/problem/3108 3108번: 로고 로고는 주로 교육용에 쓰이는 프로그래밍 언어이다. 로고의 가장 큰 특징은 거북이 로봇인데, 사용자는 이 거북이 로봇을 움직이는 명령을 입력해 화면에 도형을 그릴 수 있다. 거북이는 위치와 www.acmicpc.net import sys input = sys.stdin.readline n = int(input()) points = [] original = False for i in range(n): a, b, c, d = map(int, input().split()) points.append([a, b, c, d]) if a == 0 or c == 0: if b y2 or y4 < y1: return False if x1 .. 2021. 8. 21.
[구현] 백준 13459번: 구슬 탈출 / 골드 3 https://www.acmicpc.net/problem/13459 13459번: 구슬 탈출 첫 번째 줄에는 보드의 세로, 가로 크기를 의미하는 두 정수 N, M (3 ≤ N, M ≤ 10)이 주어진다. 다음 N개의 줄에 보드의 모양을 나타내는 길이 M의 문자열이 주어진다. 이 문자열은 '.', '#', 'O', 'R', 'B' www.acmicpc.net import copy x_lim, y_lim = map(int, input().split()) visited = [[[[False] * y_lim for _ in range(x_lim)] for _ in range(y_lim)] for _ in range(x_lim)] graph = [] for i in range(x_lim): row = [x for.. 2021. 8. 20.
반응형