Life Engineering
[프로그래머스] 카펫 (C++) 본문
https://programmers.co.kr/learn/courses/30/lessons/42842?language=cpp
#include <string>
#include <vector>
using namespace std;
vector<int> solution(int brown, int yellow) {
vector<int> answer;
int sero=1;
int garo=((brown+4)/2)-sero;
while (garo>=sero){
if (garo*sero==brown+yellow){
answer.push_back(garo);
answer.push_back(sero);
break;
}
sero++;
garo=((brown+4)/2)-sero;
}
return answer;
}
연립방정식에 기반한 완탐문제.
'Problem Solving' 카테고리의 다른 글
[BOJ 21609] 상어 중학교 (C++) (0) | 2021.10.21 |
---|---|
[프로그래머스] 가장 큰 수 (C++) (0) | 2021.10.21 |
[프로그래머스] 위장 (Python3) (0) | 2021.10.21 |
[BOJ 19236] 청소년 상어 (C++) (0) | 2021.10.20 |
[BOJ 21608] 상어 초등학교 (C++) (0) | 2021.10.18 |