백준 - 1712 손익분기점
문제
1712 손익분기점
답
kotlin code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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())
}
This post is licensed under CC BY 4.0 by the author.