목록 code review (147)
KEEP GOING
[암호만들기] https://www.acmicpc.net/problem/1759 1759번: 암호 만들기 첫째 줄에 두 정수 L, C가 주어진다. (3 ≤ L ≤ C ≤ 15) 다음 줄에는 C개의 문자들이 공백으로 구분되어 주어진다. 주어지는 문자들은 알파벳 소문자이며, 중복되는 것은 없다. www.acmicpc.net [bruteforce] from itertools import combinations l, c = map(int, input().split()) words = sorted(input().split()) for comb in list(combinations(words, l)): v, e = 0, 0 for word in comb: if word in ['a', 'e', 'i', 'o', '..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/brCtfc/btrvy2Bm9VF/7EKkUe2PIby43p7K7HwcZK/img.png)
https://www.acmicpc.net/problem/10816 10816번: 숫자 카드 2 첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10, www.acmicpc.net [dictionary, 이진탐색 사용] 이미 카운트했던 카드를 처리해주지 않아서 처음에 시간 초과가 발생했었다. n = int(input()) cards = sorted((map(int, input().split()))) m = int(input()) targets = list(map(int, input().split())) result = [] # 처음에 등장하..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bkW3Ql/btrvoPBA6G2/ZVX2jY11omfKixGgYQTtkK/img.png)
https://leetcode.com/problems/trips-and-users/ Trips and Users - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com a https://leetcode.com/problems/second-highest-salary/ Second Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to exp..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/b25mk5/btru7RGVaQN/034xFlAyYNvhe1MBjlwOzk/img.png)
https://leetcode.com/problems/reformat-department-table/ Reformat Department Table - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com [if(조건, 참, 거짓), CASE WHEN 사용] SELECT id ,SUM(CASE WHEN month = 'Jan' THEN revenue ELSE null END) as 'Jan_Revenue' ,SUM(IF(month='Feb', revenue, null)..
https://www.acmicpc.net/problem/2146 2146번: 다리 만들기 여러 섬으로 이루어진 나라가 있다. 이 나라의 대통령은 섬을 잇는 다리를 만들겠다는 공약으로 인기몰이를 해 당선될 수 있었다. 하지만 막상 대통령에 취임하자, 다리를 놓는다는 것이 아깝다 www.acmicpc.net 1. 구현 from collections import deque n = int(input()) bridge = [list(map(int, input().split())) for _ in range(n)] last_x, last_y = 0, 0 for i in range(n): for j in range(n): if bridge[i][j] == 1: last_x, last_y = i, j move = [..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/MjBWb/btru4kaReLv/knGSK8DK1LpJPTiMQRiic0/img.png)
[계단 오르기] (중하) https://www.acmicpc.net/problem/2579 2579번: 계단 오르기 계단 오르기 게임은 계단 아래 시작점부터 계단 꼭대기에 위치한 도착점까지 가는 게임이다. 과 같이 각각의 계단에는 일정한 점수가 쓰여 있는데 계단을 밟으면 그 계단에 쓰여 있는 점 www.acmicpc.net n = int(input()) stairs = [int(input()) for _ in range(n)] # dp[x] : x 번째 계단까지 이동했을 때의 최대 점수 dp = [0]*(n+1) def dynamic(): dp[0] = stairs[0] dp[1] = stairs[0] + stairs[1] for i in range(2, n): # i-2번째에서 i번째 계단을 밟는 경우..
https://www.acmicpc.net/problem/1149 1149번: RGB거리 첫째 줄에 집의 수 N(2 ≤ N ≤ 1,000)이 주어진다. 둘째 줄부터 N개의 줄에는 각 집을 빨강, 초록, 파랑으로 칠하는 비용이 1번 집부터 한 줄에 하나씩 주어진다. 집을 칠하는 비용은 1,000보다 작거나 www.acmicpc.net 1. 구현 n = int(input()) RGB = [list(map(int, input().split())) for _ in range(n)] for i in range(1, n): RGB[i][0] = min(RGB[i-1][1], RGB[i-1][2]) + RGB[i][0] RGB[i][1] = min(RGB[i - 1][0], RGB[i - 1][2]) + RGB[i]..
https://www.acmicpc.net/problem/2437 2437번: 저울 하나의 양팔 저울을 이용하여 물건의 무게를 측정하려고 한다. 이 저울의 양 팔의 끝에는 물건이나 추를 올려놓는 접시가 달려 있고, 양팔의 길이는 같다. 또한, 저울의 한쪽에는 저울추들만 놓 www.acmicpc.net 1. 구현 n = int(input()) weights = list(map(int, input().split())) weights.sort() check = 0 for w in weights: if check + 1 >= w: check += w else: break print(check+1) 2. 틀린 코드 n = int(input()) weights = list(map(int, input().split(..