Skip to content

Commit

Permalink
이슈 #403에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 29, 2024
1 parent 724a86e commit 5a62fe9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Programmers/기능개발.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// progresse와 speed를 넘기면 작업 시간을 반환해주는 함수
// 반복으로 작업시간을 가지고

#include <string>
#include <vector>
#include <queue>
#include <iostream>

using namespace std;

vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> result;
queue<int> daysQueue;

for (size_t i = 0; i < progresses.size(); ++i) {
int remainingProgress = 100 - progresses[i];
int days = (remainingProgress + speeds[i] - 1) / speeds[i];
daysQueue.push(days);
}

while (!daysQueue.empty()) {
int currentDay = daysQueue.front();
daysQueue.pop();
int count = 1;

while (!daysQueue.empty() && daysQueue.front() <= currentDay) {
daysQueue.pop();
count++;
}

result.push_back(count);
}

return result;
}

0 comments on commit 5a62fe9

Please sign in to comment.