- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevelopTech.cpp
More file actions
Latest commit
40 lines (32 loc) · 615 Bytes
/
Copy pathdevelopTech.cpp
File metadata and controls
40 lines (32 loc) · 615 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<string>
#include<vector>
#include<queue>
usingnamespacestd;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
queue<int> days;
int size = progresses.size();
int ans = 1;
for (int i = 0; i < size; i++) {
int day = (100 - progresses[i] + speeds[i] - 1) / speeds[i];
days.push(day);
}
int max = days.front();
days.pop();
while (1) {
if (days.empty()) {
answer.push_back(ans);
break;
}
if (max >= days.front()) {
ans++;
}
else {
answer.push_back(ans);
ans = 1;
max = days.front();
}
days.pop();
}
return answer;
}