일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Combinations
- Re
- 재귀함수
- 이분탐색
- lambda
- 정렬
- java
- programmers
- Set
- DateTime
- backjoon
- Zip
- python
- 파이썬
- 프로그래머스
- 동적 계획법
- 자바
- 다익스트라
- 정규식
- 추석맞이 코딩챌린지
- heapq
- KAKAO BLIND RECRUITMENT
- dfs
- 그리디
- 위클리 챌린지
- divmod
- 카카오
- BFS
- 백준
- 수학
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