백준 1026-보물
문제
코드
import sys
input = sys.stdin.readline
N = int(input())
S = 0
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
for i in range(N):
b = max(B)
S += A[i] * b
B.remove(b)
print(S)
해설
- A에서 가장 작은수와 B에서의 가장 큰수를 곱하면 더하면 작은수가 될것이라는 아이디어로 풀었다.