문제


#include <vector>
#include <cmath> // ceil
#include <queue>
using namespace std;

vector<int> solution(vector<int> progresses, vector<int>speeds) {
	vector<int> answer;
	queue<int> q;
	int days = 1;
	int i;
	for (i = 0; i < progresses.size(); i++) q.push(ceil((100 - progresses[i]) / (double)speeds[i]));

	while (!q.empty()) {
		int cnt = 1;
		int front = q.front();
		q.pop();

		while (!q.empty() && front >= q.front()) {
			q.pop();
			cnt++;
		}
		answer.push_back(cnt);
	}

	return answer;
}

vector<int> solution2(vector<int> progresses, vector<int> speeds) {
	vector<int> answer;

	int day;
	int max_day = 0;
	for (int i = 0; i < progresses.size(); i++) {
		day = (99 - progresses[i]) / speeds[i] + 1; // 각 progressesㅔ

		if (answer.empty() || max_day < day) answer.push_back(1);
		else ++answer.back();

		if (max_day < day) max_day = day;
	}

	return answer;
}