백준 1789번
https://www.acmicpc.net/problem/1789
import java.io.*
import java.util.*
// input
private lateinit var br: BufferedReader
// variables
private var S = 0L
fun main() {
br = BufferedReader(InputStreamReader(System.`in`))
val bw = BufferedWriter(OutputStreamWriter(System.out))
input()
bw.write(solve())
bw.close()
} // End of main
private fun solve(): String {
val sb = StringBuilder()
var sum = 0L
var count = 0
var idx = 1
while (true) {
sum += idx
idx++
if (sum > S) break
count++
}
sb.append(count)
return sb.toString()
} // End of solve
private fun input() {
S = br.readLine().toLong()
} // End of input