inblog logo
|
moohyun
    알고리즘문제풀기

    양꼬치

    화낼거양's avatar
    화낼거양
    Nov 25, 2024
    양꼬치
    Contents
    문제정답
     
    https://school.programmers.co.kr/learn/courses/30/lessons/120830
     

    문제

     
     
    notion image
     
    기본적으로 주어진 코드 :
    class Solution { public int solution(int n, int k) { int answer = 0; return answer; } }

    정답

     
    class Solution { public int solution(int n, int k) { int bonusFood = n / 10; int answer = (12000 * n) + (2000 * k) - (bonusFood * 2000); return answer; } }
     
    • 양꼬치를 10개 먹을 때 마다 음료수 1개가 공짜 (2000원)
    • bonusFood 는 10개 단위로 값이 1씩 증가.
    • 반환 값은 총 가격에서 bonusFood 값 * 2000원을 빼준 가격입니다.
    Share article
    Contents
    문제정답

    moohyun

    RSS·Powered by Inblog