Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 그리디
- 딕셔너리
- dfs
- 가상메모리 관리
- 구현
- level0
- 프로그래머스
- 백준
- 재귀
- 스택
- BFS
- level2
- dict
- level3
- DP
- programmers
- 수학
- python
- N과M
- MYSQL
- 브루트포스
- level1
- 다이나믹 프로그래밍
- 운영체제
- 다익스트라
- 코딩테스트
- 힙
- BOJ
- 가상메모리
- 파이썬
Archives
- Today
- Total
동캄의 코딩도장
백준 14247 [나무 자르기] 파이썬 본문
https://www.acmicpc.net/problem/14247
#백준 14247
import sys
case = int(sys.stdin.readline())
tree = list(map(int,sys.stdin.readline().split()))
grow = list(map(int,sys.stdin.readline().split()))
arr=[]
for i in range(case):
arr.append((tree[i],grow[i]))
arr.sort(key=lambda x:(x[1]))
sum=0
for i in range(case):
sum+=arr[i][0]+arr[i][1]*i
그리디한 문제이다.
'코테 > BOJ' 카테고리의 다른 글
백준 1541 [잃어버린 괄호] 파이썬 (0) | 2022.09.04 |
---|---|
백준 1931 [회의실 배정] 파이썬 (0) | 2022.09.04 |
백준 2232 [지뢰] 파이썬 (0) | 2022.09.04 |
백준 17451 [평행 우주] 파이썬 (0) | 2022.09.04 |
백준 20115 [에너지 드링크] 파이썬 (0) | 2022.09.04 |