import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
int n = kb.nextInt();
List<Integer> list1 = new ArrayList<>();
List<Integer> list2 = new ArrayList<>();
for(int i=0; i<n; i++){
list1.add(kb.nextInt());
}
Collections.sort(list1,Collections.reverseOrder());
for(int i=0; i<n; i++){
list2.add(kb.nextInt());
}
Collections.sort(list2);
int sum = 0;
for(int i=0; i<n; i++){
sum += list1.get(i) * list2.get(i);
}
System.out.println(sum);
}
}
'공부기록 > 백준' 카테고리의 다른 글
[백준] 1874번 스택 수열 (1) | 2024.01.09 |
---|---|
[백준] 1543번 문서 검색 (0) | 2024.01.09 |
[백준] 13414번 수강신청 (0) | 2024.01.03 |
[백준] 10815번 숫자 카드 (0) | 2024.01.02 |
[백준] 11478번 서로 다른 부분 문자열의 개수 (0) | 2024.01.02 |