프로그래머스 120837 개미 군단

Jmnote (토론 | 기여)님의 2023년 11월 29일 (수) 21:38 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

프로그래머스 120837 개미 군단

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(int hp) {
    int ant1 = hp/5;
    hp -= ant1 * 5;
    int ant2 = hp/3;
    hp -= ant2 * 3;
    return ant1 + ant2 + hp;
}