https://school.programmers.co.kr/learn/courses/30/lessons/42586
#include <string>
#include <vector>
#include <cmath>
using namespace std;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
int day = 0;
for (auto iter = progresses.begin(); iter != progresses.end(); ++iter)
{
int speed = speeds[iter - progresses.begin()];
int time = ceil((100 - *iter) / static_cast<float>(speed));
if (answer.empty() || day < time)
{
answer.emplace_back(1);
day = time;
}
else ++answer.back();
}
return answer;
}
'Coding Test > Programmers' 카테고리의 다른 글
[Programmers] (스택/큐) Lv 2. 프로세스 (0) | 2023.06.16 |
---|---|
[Programmers] Lv 2. 할인 행사 (0) | 2023.06.16 |
[Programmers] (2019 카카오 개발자 겨울 인턴십) Lv 2. 튜플 (0) | 2023.06.16 |
[Programmers] (해시) Lv 2. 의상 (0) | 2023.06.15 |
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [1차] 캐시 (0) | 2023.06.15 |
댓글