프로그래머스 - 최솟값 만들기
Contents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import java.util.Arrays; public class TryHelloWorld { public int getMinSum(int []A, int []B) { int answer = 0; Arrays.sort(A); Arrays.sort(B); for(int i=0;i<B.length;i++) { answer += A[i]*B[B.length-1-i]; } return answer; } public static void main(String[] args) { TryHelloWorld test = new TryHelloWorld(); int []A = {1,2}; int []B = {3,4}; System.out.println(test.getMinSum(A,B)); } } |
Author Jaejin Jang
LastMod 2017-12-23
License Jaejin Jang