본문 바로가기

백준11

17389 보너스 점수, 16165 걸그룹 마스터 준석이, 17224 APC는 왜 서브태스크 대회가 되었을까? 17389 보너스 점수, 16165 걸그룹 마스터 준석이, 17224 APC는 왜 서브태스크 대회가 되었을까? 17389 보너스 점수 # 첫번째 풀이(consol, VSC에서 되는데 백죽에서 런타임 에러.. 이유 모르겠음) N, S = int(input()), input() score, bouns = 0, 0 for i in range(N): if S[i] == 'O': score, bonus = score + i + bonus + 1, bonus + 1 else: bonus = 0 print(score) # 두번째 풀이 N, S = input(), input() score, bonus = 0, 0 for idx, OX in enumerate(S): if OX == 'O': score, bonus = s.. 2020. 10. 21.
15969 행복, 10539 수빈이와 수열, 17269 이름궁합 테스트 15969 행복, 10539 수빈이와 수열, 17269 이름궁합 테스트 15969 행복 n, array = int(input()), list(map(int, input().split())) print(max(array) - min(array)) 10539 수빈이와 수열 # 첫번째 풀이 n, array = int(input()), list(map(int, input().split())) A = [] A.append(array[0]) for i in range(1, n): A.append(array[i] * (i+1) - sum(A)) for i in range(n): if i == n-1: print(A[i]) else: print(A[i], end=' ') n, array = int(input()), l.. 2020. 10. 20.
1781 컵라면, 9663 N-Queen, 1987 알파벳 1781 컵라면, 9663 N-Queen, 1987 알파벳 1781 컵라면 import heapq n = int(input()) array = [] q = [] for _ in range(n): # take deadline, number of noodle and sorting x, y = map(int, input().split()) array.append((x, y)) array.sort() for i in array: # add noodles and if deadline over, delete minimum value in list a = i[0] heapq.heappush(q, i[1]) if a < len(q): heapq.heappop(q) print(sum(q)) - 두 원소 받아서 튜플로 정.. 2020. 10. 14.
1092 배, 2212 센서, 1461 도서관 1092 배, 2212 센서, 1461 도서관 1092 배 # 첫번째 풀이(시간 초과, 노는 크레인 생김) n = int(input()) # 크레인 개수 crane = list(map(int, input().split())) crane = sorted(crane, reverse=True) m = int(input()) # 박스 개수 box = list(map(int, input().split())) box = sorted(box) len_of_box = len(box) count = 0 if crane[0] box[len_of_box - 1]: len_of_box -= 1 count.. 2020. 10. 12.