페이지 2 / 전체 2
2. 코드
import java.util.Arrays; public class TryHelloWorld { public static void main(String[] args) { int[] A = { 1, 2, 3 }; int[] B = { 4, 5, 6 }; TryHelloWorld test = new TryHelloWorld(); System.out.println("## result=" + test.getMinSum(A, B)); } public int getMinSum(int[] A, int[] B) { int answer = 0; Arrays.sort(A); Arrays.sort(B); for (int inx = 0; inx < A.length; inx++) { answer += A[inx] * B[B.length - 1 - inx]; } return answer; } }