ShovelingLife
A Game Programmer
ShovelingLife
전체 방문자
오늘
어제
  • 분류 전체보기 (1072)
    • 그래픽스 (57)
      • 공통 (19)
      • 수학 물리 (22)
      • OpenGL & Vulkan (1)
      • DirectX (14)
    • 게임엔진 (183)
      • Unreal (69)
      • Unity (103)
      • Cocos2D-X (3)
      • 개인 플젝 (8)
    • 코딩테스트 (221)
      • 공통 (7)
      • 프로그래머스 (22)
      • 백준 (162)
      • LeetCode (19)
      • HackerRank (2)
      • 코딩테스트 알고리즘 (8)
    • CS (235)
      • 공통 (21)
      • 네트워크 (44)
      • OS & 하드웨어 (55)
      • 자료구조 & 알고리즘 (98)
      • 디자인패턴 (6)
      • UML (4)
      • 데이터베이스 (7)
    • 프로그래밍 언어 (348)
      • C++ (167)
      • C# (90)
      • Java (9)
      • Python (33)
      • SQL (30)
      • JavaScript (8)
      • React (7)
    • 그 외 (9)
      • Math (5)
      • 일상 (5)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • Source Code 좌측 상단에 복사 버튼 추가 완료
  • 언리얼 엔진 C++ 빌드시간 단축 꿀팁
  • 게임 업계 코딩테스트 관련
  • 1인칭 시점으로 써내려가는 글들

인기 글

태그

  • 알고리즘
  • 함수
  • Unity
  • SQL
  • string
  • 언리얼
  • 백준
  • 포인터
  • 티스토리챌린지
  • c#
  • 클래스
  • 배열
  • 파이썬
  • C
  • 프로그래머스
  • 오블완
  • 문자열
  • 그래픽스
  • C++
  • 유니티

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ShovelingLife

A Game Programmer

코딩테스트/프로그래머스

[2] 기능 개발

2022. 5. 31. 15:49
vector<int> solution(vector<int> progresses, vector<int> speeds)
{
    vector<int> answer;
    map<int, int> tmp_map;
    int size = progresses.size();
    int* arr_days = new int[size] {0};
 
    for (int i = 0; i < size; i++)
    {
        int count = 0;
 
        for (int j = progresses[i]; j <= 100; j += speeds[i])
        {
            progresses[i] += speeds[i];
            count++;
 
            if (progresses[i] >= 100)
            {
                arr_days[i] = count;
                break;
            }
        }
    }
    for (int i = 1; i < size; i++)
    {
        if (arr_days[i] < arr_days[i - 1])
            arr_days[i] = arr_days[i - 1];
    }
    for (int i = 0; i < size; i++)
        tmp_map[arr_days[i]]++;
 
    for (auto& item : tmp_map)
        answer.push_back(item.second);
 
    return answer;
}

'코딩테스트 > 프로그래머스' 카테고리의 다른 글

[2] 오픈 채팅방  (0) 2022.08.11
[2] 이진 변환 반복하기  (0) 2022.08.11
[1] 신고 결과 받기  (0) 2022.05.31
[3] 여행경로  (0) 2022.05.31
[3] N으로 표현  (0) 2022.05.31
    '코딩테스트/프로그래머스' 카테고리의 다른 글
    • [2] 이진 변환 반복하기
    • [1] 신고 결과 받기
    • [3] 여행경로
    • [3] N으로 표현
    ShovelingLife
    ShovelingLife
    Main skill stack => Unity C# / Unreal C++ Studying Front / BackEnd, Java Python

    티스토리툴바