223. 치킨 쿠폰

김해준's avatar
Jan 09, 2026
223. 치킨 쿠폰

사용언어 : Java

문제
notion image
풀이
/* chicken = 1081 coupon = 1081 total = 0 bonus : coupon / 10 = 108 ... 1 coupon = 109 total = 108 bonus : coupon / 10 = 10 ... 9 coupon = 19 total = 118 bonus : coupon / 10 = 1 ... 9 coupon = 10 total = 119 bonus : coupon / 10 = 1 coupon = 1 total = 120 return total = 120 */ class Solution { public int solution(int chicken) { int answer = 0; while(true) { answer += chicken / 10; chicken = (chicken / 10) + (chicken % 10); if(chicken < 10) break; } return answer; } }
notion image
Share article