Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 안드로이드
- android
- Navigation
- textview
- livedata
- TEST
- Kotlin
- Flutter
- 앱
- CustomScrollView
- Compose
- LifeCycle
- binding
- ScrollView
- drift
- viewmodel
- tabbar
- appbar
- 테스트
- 앱바
- textfield
- activity
- DART
- Coroutines
- scroll
- Button
- Dialog
- intent
- data
- 계측
Archives
- Today
- Total
Study Record
[프로그래머스] Level2 - 기능개발 본문
728x90
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> progresses, vector<int> speeds) {
vector<int> answer;
int day = 0, i=0, len = speeds.size();
while(i < len){
int needDay = (100 - progresses[i])/speeds[i];
if( (100 - progresses[i]) % speeds[i] != 0) needDay++;
int num = 1;
if(day != needDay && day < needDay) day = needDay;
i++;
while(i < len){
if(progresses[i] + day * speeds[i] >= 100){
num++;
i++;
} else break;
}
answer.push_back(num);
}
return answer;
}
728x90
'알고리즘' 카테고리의 다른 글
[프로그래머스] Level2 - 프린터 <Queue> (0) | 2021.12.04 |
---|---|
[프로그래머스] Level1 - 음양 더하기 / 내적 (0) | 2021.12.03 |
[프로그래머스] Level1 - 없는 숫자 더하기 (0) | 2021.12.02 |
[프로그래머스] Level2 - 카카오프렌즈 컬러링북 (0) | 2021.12.02 |
[프로그래머스] Level1 - 크레인 인형뽑기 게임 <스택> (0) | 2021.12.02 |