https://www.acmicpc.net/problem/28228코드import sysinput = sys.stdin.readlinen, m = map(int, input().split())parking_lot = [list(input()) for _ in range(n)]# 위쪽for c in range(m): r = 0 while r = 0 and parking_lot[r][c] != "o": parking_lot[r][c] = "-" r -= 1# 왼쪽for r in range(n): c = 0 while c = 0 and parking_lot[r][c] != "o": parking_lot[r][c] = "-" c -= 1an..
문제풀이/Greedy
https://www.acmicpc.net/problem/1036 코드from collections import defaultdictn = int(input())nums = [input() for _ in range(n)]k = int(input())base36 = [str(x) for x in range(10)]+[chr(x) for x in range(65, 91)]def decimal_to_base36(num): if num == 0: return "0" result = "" while num != 0: result = base36[num % 36]+result num //= 36 return resultgap = defaultdict(in..
https://www.acmicpc.net/problem/1946코드from heapq import heappop, heappushimport sysinput = sys.stdin.readlinefor _ in range(int(input())): n = int(input()) applicants = [] for _ in range(n): doc, interview = map(int, input().split()) heappush(applicants, (doc, interview)) answer = 1 comp_interview = heappop(applicants)[1] while applicants: now = heappop(app..
https://school.programmers.co.kr/learn/courses/30/lessons/389479코드function solution(players, m, k) { let answer = 0; // 최소 서버 증설 횟수 const servers = []; for (let time = 0; time = k) { servers.shift(); } // 어느 시간대의 이용자가 n x m명 이상 (n + 1) x m명 미만이라면 최소 n대의 증설된 서버가 운영 중이어야 합니다. const n = Math.floor(players[time] / m); if (servers.length 오늘 배운 것- 주석은 안 달아야 베스트다? => ❌. 이 문제를 잘 모르는..

https://www.acmicpc.net/problem/17615 코드 (100점)import sysinput = sys.stdin.readlinen = int(input().strip())balls = input().strip()red_right = (balls.rstrip('R')).count('R')red_left = (balls.lstrip('R')).count('R')blue_right = (balls.rstrip('B')).count('B')blue_left = (balls.lstrip('B')).count('B')print(min([red_right, red_left, blue_left, blue_right])) 빨간색과 파란색이 각각 왼쪽으로 몰았을 때와 오른쪽으로 몰았을 때의 이동 횟수..