일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Java
- popleft
- 프로그래머스
- python3
- 합 구하기
- BFS
- DP
- 파이썬
- JPA
- 완전탐색
- 백준
- 브루투포스
- c#
- 우선순위큐
- C#강의
- 누적합
- 연관관계
- Python
- LCM
- mvc
- appendleft
- 소수판별
- 그리디 알고리즘
- unity
- deque
- pypy3
- spring
- 1일1솔
- 인프런
- 소수찾기
- Today
- Total
목록분류 전체보기 (139)
jae_coding

문제 문제 링크 코드 import sys input = sys.stdin.readline n = int(input()) place = list(map(int, input().split())) sum_place = sum(place) # bee bee honey b_b_h = 0 bee = place[0] for i in range(1, n): bee += place[i] first_bee = sum_place - place[0] - place[i] # 첫번째 벌이 먹는 꿀의 양 second_bee = sum_place - bee # 두번째 벌이 먹는 꿀의 양 b_b_h = max(b_b_h, first_bee + second_bee) # honey bee bee h_b_b = 0 place.reverse..

문제 문제 링크 코드 import sys input = sys.stdin.readline input_string = list("A" + input().strip()) count = 0 min_result = "" max_result = "" # max_val for i in range(len(input_string)): c = input_string[i] if c == 'M': count += 1 if input_string[i-1] == 'M': min_result += "0" else: min_result += "1" elif c == 'K': min_result += "5" if count == 0: max_result += "5" else: max_result += str(5 * 10 ** cou..

문제 문제 링크 코드 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..

문제 문제 링크 코드 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)

문제 문제 링크 코드 import sys input = sys.stdin.readline n = int(input()) energy_drinks = list(map(int, input().split())) energy_drinks.sort() result = energy_drinks[n-1] for i in range(n-1): result += energy_drinks[i] / 2 print(result)

문제 문제 링크 코드 import sys input = sys.stdin.readline n = int(input()) C = list(int(input()) for _ in range(n)) C.sort() result = 0 count = 0 while C: count += 1 x = C.pop() if count % 3 != 0: result += x print(result)

문제 문제 링크 코드 import sys input = sys.stdin.readline def tip(money, idx): return money - (idx - 1) n = int(input()) lst = list(int(input()) for _ in range(n)) lst.sort(reverse=True) result = 0 for i in range(n): t = tip(lst[i], i+1) if t >= 0: result += t print(result)

문제 문제 링크 코드 import sys input = sys.stdin.readline n = int(input()) temp = n flag = False count = 0 if int(n / 5) > 0: count += int(n / 5) n = n - 5 * int(n / 5) while n != 0: if n % 2 == 0: count += int(n / 2) n = n - 2 * int(n / 2) else: count -= 1 n += 5 if temp < n: flag = True if flag: print(-1) else: print(count)

문제 문제 링크 코드 import sys input = sys.stdin.readline input_string = list(input().strip()) stack = list() ans = 0 count = 1 primary_value = 0 for i in input_string: if i == '(': count *= 2 stack.append(i) elif i == '[': count *= 3 stack.append(i) elif i == ')': # 올바른 괄호열이 아닐 경우 if not stack or stack[-1] == '[': ans = 0 break elif primary_value == '(': ans += count count //= 2 stack.pop() elif i == '..

문제 문제 링크 코드 list사용 코드 import sys input = sys.stdin.readline n = int(input()) array = [0] * 10001 for _ in range(n): array[int(input())] += 1 for i in range(10001): num = i if array[i] != 0: for _ in range(array[i]): print(i) dict사용 코드 import sys input = sys.stdin.readline n = int(input()) memo = dict() lst = list() for _ in range(n): temp = int(input()) if temp not in memo: memo[temp] = 1 else: ..