結果

問題 No.1412 Super Ryuo
ユーザー 箱星箱星
提出日時 2021-02-28 21:43:30
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 11,106 ms
コンパイル使用メモリ 428,608 KB
実行使用メモリ 50,132 KB
最終ジャッジ日時 2024-10-02 22:16:15
合計ジャッジ時間 16,047 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.absoluteValue

fun PrintWriter.solve() {
    val a = nextLong()
    val b = nextLong()
    val c = nextLong()
    val d = nextLong()
    val dist = (a - c).absoluteValue + (b - d).absoluteValue
    println(if (dist <= 3 || a == c || b == d) 1 else 2)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()!!
fun nextDouble() = next().toDouble()
// endregion
0