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 |
Tags
- substr
- 코테
- 백준
- 다이나믹프로그래밍
- sql고득점kit
- MySQL
- 참고 문헌 : MACHINE LEARNING 기계학습 _ 오일석
- 우선순위큐
- C++
- 스택
- 최대공약수
- DP
- 코테준비
- 동적계획법
- vector
- 시스템콜
- String
- 리시프
- 프로그래머스
- 정렬
- set
- 문자열
- Dijkstra
- 플로이드와샬
- MAP
- unordered_map
- 다익스트라
- 알고리즘
- dfs
- 코딩테스트연습
Archives
- Today
- Total
YeJin's Footsteps
기능 개발 본문
문제 링크
https://programmers.co.kr/learn/courses/30/lessons/42586
코딩테스트 연습 - 기능개발
프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있습니다. 또, 각 기능의 개발속도는 모두 다르기 때문에 뒤에 있는 기능이 앞에 있는
programmers.co.kr
문제 코드 풀이
#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