Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 스택
- 코테준비
- String
- set
- 문자열
- 리시프
- 동적계획법
- 우선순위큐
- C++
- 프로그래머스
- MySQL
- 코테
- MAP
- unordered_map
- 최대공약수
- 플로이드와샬
- 정렬
- 시스템콜
- DP
- 백준
- Dijkstra
- 다이나믹프로그래밍
- dfs
- 알고리즘
- vector
- 참고 문헌 : MACHINE LEARNING 기계학습 _ 오일석
- 코딩테스트연습
- sql고득점kit
- substr
- 다익스트라
Archives
- Today
- Total
YeJin's Footsteps
기능 개발 본문
문제 링크
https://programmers.co.kr/learn/courses/30/lessons/42586
문제 코드 풀이
#include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
vector<int> day;
for(int i=0; i<progresses.size(); i++){
if((100-progresses[i])%speeds[i]==0){
day.push_back((100-progresses[i])/speeds[i]);
}else{
day.push_back((100-progresses[i])/speeds[i]+1);
}
}
int p=day[0]; int cnt=0;
for(int i=0; i<day.size(); i++){
if(p>=day[i]) cnt++;
else {
answer.push_back(cnt);
p=day[i];
cnt=1;
}
}
answer.push_back(cnt);
return answer;
}
'Computer Science & Engineering > 알고리즘' 카테고리의 다른 글
Algorithm Study_0703 (0) | 2021.07.03 |
---|---|
프린터 (0) | 2021.07.02 |
H-Index (0) | 2021.07.01 |
가장 큰 수 (0) | 2021.07.01 |
불량사용자 (0) | 2021.05.07 |
Comments