[C++] 프로그래머스 최소 직사각형


[C++] 프로그래머스 최소 직사각형

문제 소스 코드 #include <string> #include <vector> #include <map> #include <iostream> using namespace std; map<int, int> find_factor(int yellow) { map<int, int> m; if(yellow == 1) { m.insert(make_pair(1,1)); } else { for(int i=1; i<= yellow/2;i++) { if(yellow % i == 0) { m.insert(make_pair(i, yellow/i)); } else continue; } } return m; } vector<int> solution(int brown, int yellow) { vector<int> answer; map<int, int> m; m = find_factor(yellow); for(auto i:m) { if(i.first * 2 + (i.second+2)*2 == brown) {...



원문링크 : [C++] 프로그래머스 최소 직사각형