[백준 1026][Python] 보물

봉글렛·2023년 1월 23일

백준

목록 보기
42/55

문제 링크 https://www.acmicpc.net/problem/1026

문제에서 B의 순서를 변경하지 말라고 했지만 과정에 대한 검사는 없기 때문에 변경해도 무방하다.

n = int(input())
a = [*map(int, input().split())]
b = [*map(int, input().split())]

a.sort()
b.sort(reverse=True)
result = 0
for i in range(n):
    result += a[i]*b[i]
print(result)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글