https://programmers.co.kr/learn/courses/30/lessons/12941?language=cpp
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int solution(vector<int> A, vector<int> B)
{
int answer = 0;
sort(A.begin(), A.end());
sort(B.begin(), B.end());
reverse(B.begin(), B.end());
for(int i=0;i<A.size();i++)
answer += A[i] * B[i];
return answer;
}
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int getMinSum(vector<int> A, vector<int> B)
{
int answer = 0;
sort(A.begin(), A.end());
sort(B.begin(), B.end());
for (int i = 0; i < A.size(); i++)
answer += A.at(i) * B.at(A.size() - i - 1);
return answer;
}
int main()
{
vector<int> tA{1,2,3}, tB{3,4,5};
//아래는 테스트 출력을 위한 코드입니다.
cout<<getMinSum(tA,tB);
}