Skip to content

[Algorithm] 콜라 문제 #95

Description

@hwangJi-dev

💬 문제

[코딩테스트 연습 - 콜라 문제](https://school.programmers.co.kr/learn/courses/30/lessons/132267)


💬 Idea

  • n에도 b를 곱해주어야한다는 것을 간과해서 오래 걸린 문제.. 문제 이해를 잘하자 !!!!!

💬 풀이

func solution(a:Int, b:Int, n:Int)->Int{varn= n
varresult=0while n >= a {
result +=(n / a)* b
n =(n / a)* b +(n % a)}return result
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions