Skip to content

카펫 #417

@fkdl0048

Description

@fkdl0048
#include <string>
#include <vector>

using namespace std;

vector<int> solution(int brown, int yellow) {
    vector<int> answer;
    
    int totalSize = brown + yellow;
    
    for (int i = 3; i < totalSize / 2; i++) {
        if (totalSize % i != 0)
            continue;
        
        int width = i;
        int heigth = totalSize / i;
        
        if (width * 2 + heigth * 2 - 4 == brown) {
            answer.push_back(max(width, heigth));
            answer.push_back(min(width, heigth));
            break;
        }
    }
    
    return answer;
}

Metadata

Metadata

Assignees

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions