세상을 더 좋게

[Baekjoon] 2420 Safari World (Kotlin) 사파리 월드 (코틀린) 본문

Algorithm/[solved.ac] 새싹 Class

[Baekjoon] 2420 Safari World (Kotlin) 사파리 월드 (코틀린)

나는SOU 2024. 3. 1. 19:25

https://www.acmicpc.net/problem/2420

 

2420번: 사파리월드

첫째 줄에 두 도메인의 유명도 N과 M이 주어진다. (-2,000,000,000 ≤ N, M ≤ 2,000,000,000)

www.acmicpc.net

fun main() {
    val input = readLine()!!.split(" ")
    val N = input[0].toLong()
    val M = input[1].toLong()
    
    val result = Math.abs(N - M)
    println(result)
}

Do you know get absolute value with kotlin?

If you get it, this problem is very simple.

But be careful to number type.