입출력 1번에서는 7 - 3 - 9 일작업순 이고
입출력 2번에서는 5 - 10 - 1 - 1 - 20 - 1 일작업순이다 .
규칙성을 찾을 수 있다.
1번의 결과는 2 - 1 이고
2번의 결과는 1 - 3 - 2 이다.
7번을 가지고 마지막 인덱스까지 비교하면서 큰 값이 나오면 종료하고,
작은 값이 나오면 증가하는 방식을 생각해낼 수 있다.
#include <string>
#include <vector>
#include <queue>
using namespace std;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
queue<int>q;
for(int i = 0; i < progresses.size(); i++)
{
if((100 - progresses[i]) % speeds[i] == 0)
{
q.push ((100 - progresses[i]) / speeds[i]);
}
else
{
q.push((100 - progresses[i]) / speeds[i] + 1);
}
}
while(!q.empty())
{
int tmp = q.front();
q.pop();
int n = 1;
while(q.front() <= tmp && !q.empty())
{
n++;
q.pop();
}
answer.push_back(n);
}
return answer;
}