DuckingRacoon
프로그래머스 | 최솟값 만들기 본문
출처
🌐 코딩테스트 연습 - 최솟값 만들기 | 프로그래머스 스쿨
풀이
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int solution(vector<int> A, vector<int> B)
{
sort(A.begin(), A.end());
sort(B.begin(), B.end(), greater<int>());
int answer = 0;
for (int i = 0; i < A.size(); ++i)
{
answer += A[i] * B[i];
}
return answer;
}
'알고리즘' 카테고리의 다른 글
| 프로그래머스 | 삼각 달팽이 (0) | 2025.09.03 |
|---|---|
| 프로그래머스 | 이진 변환 반복하기 (0) | 2025.09.03 |
| 프로그래머스 | 최댓값과 최솟값 (1) | 2025.09.03 |
| 프로그래머스 | 합승 택시 요금 (0) | 2025.09.03 |
| 프로그래머스 | 숫자 게임 (0) | 2025.09.03 |