| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 프로그래머스
- spring
- 그리디 알고리즘
- deque
- mvc
- unity
- JPA
- c#
- popleft
- appendleft
- python3
- Python
- 파이썬
- Java
- 인프런
- pypy3
- 백준
- C#강의
- 완전탐색
- 소수찾기
- 합 구하기
- 연관관계
- LCM
- 우선순위큐
- 소수판별
- 브루투포스
- 1일1솔
- BFS
- DP
- 누적합
Archives
- Today
- Total
목록전체 글 (139)
jae_coding
문제 문제 링크 코드 import sys from collections import deque input = sys.stdin.readline n = int(input()) colors = deque(input().strip()) result_colors = list() primary_color = "" while colors: x = colors.popleft() if x != primary_color: result_colors.append(x) primary_color = x if result_colors.count('B') >= result_colors.count('R'): result = 1 + result_colors.count('R') else: result = 1 + result_colors..
알고리즘 문제/그리디 문제
2022. 7. 20. 13:49
문제 문제 링크 코드 import sys input = sys.stdin.readline n = int(input()) t = list(map(int, input().split())) t.sort() result = -1 if n % 2 == 0: for i in range(int(n / 2)): result = max(result, t[i] + t[len(t)-i-1]) else: result = max(result, t.pop()) for i in range(int(n / 2)): result = max(result, t[i] + t[len(t)-i-1]) print(result)
알고리즘 문제/그리디 문제
2022. 7. 20. 13:35