[백준] Automated Telephone Exchange (3507)(kotlin)
문제 설명
입력 및 출력
» 입력
The input file contains a single integer number n — the index of Peter’s ATE (100 ≤ n ≤ 999).
» 출력
Output a single integer number — the number of lucky phone numbers Peter’s ATE has.
예제 입출력(테스트케이스)
입력 | 출력 |
---|---|
196 | 3 |
239 | 0 |
문제 풀이1
import java.io.BufferedReader
import java.io.InputStreamReader
fun main(args: Array<String>) = with(BufferedReader(InputStreamReader(System.`in`))) {
val ate = readLine().toInt()
var count = 0
if (ate <= 198) {
for (i in 99 downTo 0) {
if (ate - i > 99) break
else count++
}
}
println(count)
}