[문제링크 - 프로그래머스 - 피자 나눠 먹기(1)] https://school.programmers.co.kr/learn/courses/30/lessons/120814
class Solution {
public int solution(int n) {
return (n%7 == 0) ? n/7 : n/7+1;
}
}
class Solution1 {
public int solution(int n) {
return (n+6) / 7;
}
}
7로 나눈 나머지의 최대값은 6이므로
n = 1일 때, 7/7 = 1
n = 2일 때, 8/7 = 1
n = 3일 때, 9/7 = 1
n = 4일 때, 10/7 = 1
n = 5일 때, 11/7 = 1
n = 6일 때, 12/7 = 1
n = 7일 때, 13/7 = 1
n = 8일 때, 14/7 = 2