[c++] 프로그래머스 :: 카펫 (brute force)
Algorithm 문제/프로그래머스 2020. 5. 28. 21:50

카펫 코드 #include #include #include using namespace std; vector solution(int brown, int yellow) { vector answer; vector candidate; for (int i = 1; i 맞으면 (가로, 세로) 길이를 결과 vector에 넣어서 return brown 갯수 = 2*가로yellow + 2*세로yellow +4 4 : 양쪽 모서리 다른 사람의 코드 #include #include using namespace std; vector solution(int brown, int red) { int len = brown / 2 + 2; int w = len - 3; int h = 3; while(w >= h){ if(w * h ..