보물(그리디)

mangyun·2021년 11월 30일
0

BOJ

목록 보기
12/21

https://www.acmicpc.net/problem/1026

1. 코드

n = int(input())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = 0
for i in range(n):
    s += min(a) * max(b)
    a.pop(a.index(min(a)))
    b.pop(b.index(max(b)))

print(s)

2. 아이디어

인덱스 받기는 .index()
배열 빼기는 .pop() 을 이용해 계산한다.

profile
기억보다는 기록을 하자.

0개의 댓글