본문 바로가기
프로그래머스

[42583] 주식가격

by Jcoder 2018. 9. 14.


#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> prices)
{
vector<int> answer;
int i, j, time = 0;
for (i = 0; i < prices.size(); i++)
{
int max = prices[i];
for (j = i; j < prices.size() - 1; j++)
if (max <= prices[j])
time++;
else
break;
answer.push_back(time);
time = 0;
}
return answer;
}


'프로그래머스' 카테고리의 다른 글

[14406] 소수의 합  (0) 2018.10.28
[42840] 모의고사  (0) 2018.10.21
[42588] 탑  (0) 2018.10.20
[42862] 체육복  (0) 2018.10.20
[42748] K번째수  (0) 2018.09.17