• Home
  • About
    • Moon photo

      Moon

      개발자는 자고 싶다.

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • Posts
    • All Posts
    • All Tags
  • Projects

백준 - 1712 손익분기점

07 Jun 2022

Reading time ~1 minute

문제

1712 손익분기점

screencapture

답

kotlin code

import java.util.*

fun main() {
    q1712()
}

fun q1712() = with(Scanner(System.`in`)) {
    val a = nextDouble()
    val b = nextDouble()
    val c = nextDouble()

    if(b >= c) {
        println(-1);
        return
    }

    val result = a / (c - b)
    val resultCell = kotlin.math.ceil(result)
    if(result == resultCell) println((result.toInt() + 1)) else println(resultCell.toInt())
}


baekjoonkotlin코틀린백준브론즈수학사칙연산 Share Tweet +1