백준 624

백준(Python) 1543번 문서 검색 풀이

Python으로 구현한 1543번 문서 검색 문제 풀이입니다. https://www.acmicpc.net/problem/1543 1543번: 문서 검색 세준이는 영어로만 이루어진 어떤 문서를 검색하는 함수를 만들려고 한다. 이 함수는 어떤 단어가 총 몇 번 등장하는지 세려고 한다. 그러나, 세준이의 함수는 중복되어 세는 것은 빼고 세야 한 www.acmicpc.net s = input() target = input() result = 0 num = 0 while num

백준(Python) 13305번 주유소 풀이

Python으로 구현한 13305번 주유소 문제 풀이입니다. https://www.acmicpc.net/problem/13305 13305번: 주유소 표준 입력으로 다음 정보가 주어진다. 첫 번째 줄에는 도시의 개수를 나타내는 정수 N(2 ≤ N ≤ 100,000)이 주어진다. 다음 줄에는 인접한 두 도시를 연결하는 도로의 길이가 제일 왼쪽 도로부터 N-1 www.acmicpc.net n = int(input()) distance = list(map(int, input().split())) price = list(map(int, input().split())) result = 0 m = price[0] for i in range(n - 1) : if price[i] < m : m = price[i] re..

백준(Python) 3190번 뱀 풀이

Python으로 구현한 3190번 뱀 문제 풀이입니다. https://www.acmicpc.net/problem/3190 3190번: 뱀 'Dummy' 라는 도스게임이 있다. 이 게임에는 뱀이 나와서 기어다니는데, 사과를 먹으면 뱀 길이가 늘어난다. 뱀이 이리저리 기어다니다가 벽 또는 자기자신의 몸과 부딪히면 게임이 끝난다. 게임 www.acmicpc.net n = int(input()) k = int(input()) data = [[0] * (n + 1) for _ in range(n + 1)] # 맵 정보 info = [] # 방향 회전 정보 # 맵 정보(사과 있는 곳은 1로 표시) for _ in range(k): a, b = map(int, input().split()) data[a][b] = 1..

백준(Python) 12723번 Minimum Scalar Product (Small) 풀이

Python으로 구현한 12723번 Minimum Scalar Product (Small) 문제 풀이입니다. https://www.acmicpc.net/problem/12723 12723번: Minimum Scalar Product (Small) You are given two vectors v1=(x1,x2,...,xn) and v2=(y1,y2,...,yn). The scalar product of these vectors is a single number, calculated as x1y1+x2y2+...+xnyn. Suppose you are allowed to permute the coordinates of each vector as you wish. Choose two permuta www.a..

백준(Python) 11597번 Excellence 풀이

Python으로 구현한 11597번 Excellence 문제 풀이입니다. https://www.acmicpc.net/problem/11597 11597번: Excellence The World Coding Federation is setting up a huge online programming tournament of teams comprised of pairs of programmers. Judge David is in charge of putting teams together from the Southeastern delegation. Every student must be placed on exactly one team www.acmicpc.net n = int(input()) data = [] ..

백준(Python) 13238번 Bitcoin investment 풀이

Python으로 구현한 13238번 Bitcoin investment 문제 풀이입니다. https://www.acmicpc.net/problem/13238 13238번: Bitcoin investment Bitcoin is a digital asset and a payment system invented by Satoshi Nakamoto. It is not known whether the name "Satoshi Nakamoto" is real or a pseudonym, or whether the name represents one person or a group of people. It was once rumoured by New Yorker M www.acmicpc.net n = int(input..

백준(Python) 12034번 김인천씨의 식료품가게 (Large) 풀이

Python으로 구현한 12034번 김인천씨의 식료품가게 (Large) 문제 풀이입니다. https://www.acmicpc.net/problem/12034 12034번: 김인천씨의 식료품가게 (Large) 입력의 첫 번째 라인(줄)은 테스트 사례의 케이스의 수 T를 나타냅니다. 이후의 라인은 T개의 테스트 케이스가 이어집니다. 각 테스트 케이스는 두 줄로 구성됩니다. 첫 번째 줄에는 INU 식료품가 www.acmicpc.net t = int(input()) for tc in range(1, t + 1) : n = int(input()) data = sorted(map(int, input().split()), reverse=True) result = [] while data : price = data.p..

백준(Python) 23305번 수강변경 풀이

Python으로 구현한 23305번 수강변경 문제 풀이입니다. https://www.acmicpc.net/problem/23305 23305번: 수강변경 $2$번 학생과 $3$번 학생이 수업을 교환한 후, $3$번 학생이 교환한 수업을 $5$번 학생과 교환하게 되면 $2$/$3$/$5$ 번 학생이 원하는 수업을 수강할 수 있다. www.acmicpc.net n = int(input()) data = [0] * 1000001 for i in list(map(int, input().split())) : data[i] += 1 result = 0 for i in list(map(int, input().split())) : if data[i] >= 1 : data[i] -= 1 else : result += 1..

백준(Python) 18787번 Mad Scientist 풀이

Python으로 구현한 18787번 Mad Scientist 문제 풀이입니다. https://www.acmicpc.net/problem/18787 18787번: Mad Scientist First, FJ can transform the substring that corresponds to the first character alone, transforming $B$ into GHGGGHH. Next, he can transform the substring consisting of the third and fourth characters, giving $A$. Of course, there are other combinations of t www.acmicpc.net n = int(input()) a = ..

백준(Python) 1817번 짐 챙기는 숌 풀이

Python으로 구현한 1817번 짐 챙기는 숌 문제 풀이입니다. https://www.acmicpc.net/problem/1817 1817번: 짐 챙기는 숌 첫째 줄에 책의 개수 N과 박스에 넣을 수 있는 최대 무게 M이 주어진다. N은 0보다 크거나 같고 50보다 작거나 같은 정수이고, M은 1,000보다 작거나 같은 자연수이다. N이 0보다 큰 경우 둘째 줄에 책 www.acmicpc.net n, m = map(int, input().split()) if n == 0 : print(0) else : data = list(map(int, input().split())) target = 0 result = 1 for i in range(n-1, -1, -1) : target += data[i] if t..