/* Problem is a bit tricky. Text can use some improvements (see slack message). In the end, calculate the three different expected scenarios and determine the result. Pitfall is not to forget the extra enter after finishing the password. */ fun main() { val (n, k, p) = readln().split(" ").map { it.toInt() } val error = p / 100.0 val success = 1.0 - error val fullReEnter = CLEAR_SPEED + TYPE_SPEED * (n + 1) val finishTime = (n - k + 1) * TYPE_SPEED // time to finish and if wrong also need re-enter of password val expectedContinueTime = finishTime + error * (fullReEnter) // time to finish with an extra backspace stroke and if password was correct re-enter val backspaceTime = finishTime + TYPE_SPEED + success * fullReEnter println( when { expectedContinueTime < backspaceTime && expectedContinueTime < fullReEnter -> "continue" backspaceTime < expectedContinueTime && backspaceTime < fullReEnter -> "backspace" else -> "restart" } ) } const val TYPE_SPEED = 0.1 const val CLEAR_SPEED = 0.3