티스토리 뷰
https://programmers.co.kr/learn/courses/30/lessons/42586
코딩테스트 연습 - 기능개발
프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있습니다. 또, 각 기능의 개발속도는 모두 다르기 때문에 뒤에 있는 기능이 앞에 있는
programmers.co.kr
[프로그래머스][C++] 기능개발
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
int dayM = -1;
int day;
int left;
for (int i = 0; i < progresses.size(); i++) {
left = 100 - progresses[i];
day = left / speeds[i] + (left % speeds[i] ? 1 : 0);
if (dayM < day) {
answer.push_back(1);
dayM = day;
}
else {
answer[answer.size() - 1]++;
}
}
return answer;
}
'Problem Solving' 카테고리의 다른 글
[프로그래머스][C++] 전화번호 목록 (0) | 2022.05.24 |
---|---|
[프로그래머스][C++] 행렬 테두리 회전하기 (0) | 2022.05.20 |
[프로그래머스][C++] JadenCase 문자열 만들기 (0) | 2022.05.17 |
[프로그래머스][C++] 네트워크 (0) | 2022.05.08 |
[프로그래머스][C++] 더 맵게 (0) | 2022.05.08 |
댓글