https://school.programmers.co.kr/learn/courses/30/lessons/120837
가장 큰 수인 5먼저 구하고 3, 1순서로 구한다.hp/1은 굳이 왜 나누었는지.
그냥 hp로 쓰면될듯
#include <string>
#include <vector>
using namespace std;
int solution(int hp) {
int answer = 0;
answer += hp/5;
hp %= 5;
answer += hp/3;
hp %= 3;
answer += hp/1;
return answer;
}
#include <string>
#include <vector>
using namespace std;
int solution(int hp) {
int answer = 0;
answer += hp / 5;
hp = hp % 5;
answer += hp / 3;
hp = hp % 3;
answer += hp;
return answer;
}
같은 방법이다.