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
- to_attr
- docker
- 도커
- django
- Transaction
- DRF
- CD
- database
- Python
- 백준
- DjangoCache
- Continuous Deployment
- testcase
- Coroutine
- CI
- racecondition
- apitestcase
- DjangoRestFramework
- nestedfunction
- QuerySet
- 코루틴
- Git
- Prefetch_related
- aws
- aggregate
- Continuous Delivery
- dry-yasg
- EC2
- F객체
- annotate
Archives
- Today
- Total
BackEnd King KY
백준 2217 본문
728x90
✔️문제
https://www.acmicpc.net/problem/2217
2217번: 로프
N(1 ≤ N ≤ 100,000)개의 로프가 있다. 이 로프를 이용하여 이런 저런 물체를 들어올릴 수 있다. 각각의 로프는 그 굵기나 길이가 다르기 때문에 들 수 있는 물체의 중량이 서로 다를 수도 있다. 하
www.acmicpc.net
✔️풀이
k = int(input())
a=0
l=[]
m=[]
for i in range(k):
l.append(int(input()))
l.sort(reverse=True)
for i,v in enumerate(l):
m.append( (i+1)*l[i] )
print(max(m))
받은 중량을 역순으로 나눈 뒤, 인덱스와 곱한 값을 배열에 넣어줍니다.
최대 중량을 구하는 문제이므로 max를 붙여 최대값을 붙여줍니다.