문제 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/86491
맞힌 코드
#include <bits/stdc++.h>
using namespace std;
int solution(vector<vector<int>> sizes) {
int w = 0;
int h = 0;
for (int i=0; i<sizes.size(); i++){
if (sizes[i][0]<sizes[i][1]){
int temp = sizes[i][0];
sizes[i][0] = sizes[i][1];
sizes[i][1] = temp;
}
if (sizes[i][0]>w)
w = sizes[i][0];
if (sizes[i][1]>h)
h = sizes[i][1];
}
return w*h;
}
'Algorithm' 카테고리의 다른 글
[프로그래머스] 42839번 소수 찾기 C++ (0) | 2024.11.13 |
---|---|
[프로그래머스] 42840번 모의고사 C++ (0) | 2024.11.13 |
[프로그래머스] 42747번 H-Index C++ (0) | 2024.11.13 |
[프로그래머스] 42748번 K번째수 C++ (0) | 2024.11.12 |
[프로그래머스] 43162번 네트워크 C++ (0) | 2024.11.11 |