| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- Zip
- lambda
- 정규식
- python
- 이분탐색
- 프로그래머스
- BFS
- 카카오
- 자바
- 추석맞이 코딩챌린지
- programmers
- 백준
- 정렬
- 다익스트라
- DateTime
- heapq
- 수학
- 파이썬
- backjoon
- dfs
- Combinations
- Re
- 위클리 챌린지
- 동적 계획법
- Set
- 재귀함수
- 그리디
- KAKAO BLIND RECRUITMENT
- java
- divmod
Archives
- Today
- Total
상상쓰
[백준] 슬라임 합치기 본문
https://www.acmicpc.net/problem/14241
14241번: 슬라임 합치기
영선이와 효빈이는 슬라임을 합치는 게임을 하고 있다. 두 사람은 두 슬라임을 골라서 하나로 합쳐야 한다. 게임은 슬라임이 하나 남았을 때 끝난다. 모든 슬라임은 양수 크기를 가지고 있다. 두
www.acmicpc.net
슬라임을 합쳐봅시다!
import sys
N = int(sys.stdin.readline())
array = list(map(int, sys.stdin.readline().split()))
array.sort(reverse=True)
answer = 0
for i in range(1, len(array)):
answer += (array[i-1] * array[i])
array[i] = array[i-1] + array[i]
print(answer)'Coding Test' 카테고리의 다른 글
| [백준] ZOAC 2 (0) | 2021.06.30 |
|---|---|
| [프로그래머스] 체육복 (0) | 2021.06.30 |
| [프로그래머스] 디스크 컨트롤러 (0) | 2021.06.29 |
| [프로그래머스] 순위 (0) | 2021.06.29 |
| [백준] 라디오 (0) | 2021.06.28 |
Comments