結果

問題 No.1412 Super Ryuo
ユーザー 👑 箱
提出日時 2021-02-28 21:43:30
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 293 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 15,578 ms
コンパイル使用メモリ 421,808 KB
実行使用メモリ 50,404 KB
最終ジャッジ日時 2023-07-26 05:04:22
合計ジャッジ時間 19,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 277 ms
50,168 KB
testcase_01 AC 272 ms
50,108 KB
testcase_02 AC 280 ms
50,088 KB
testcase_03 AC 280 ms
50,192 KB
testcase_04 AC 277 ms
50,108 KB
testcase_05 AC 282 ms
49,940 KB
testcase_06 AC 285 ms
50,384 KB
testcase_07 AC 293 ms
50,404 KB
testcase_08 AC 290 ms
50,280 KB
testcase_09 AC 284 ms
49,940 KB
testcase_10 AC 291 ms
50,344 KB
testcase_11 AC 291 ms
50,324 KB
testcase_12 AC 285 ms
50,080 KB
testcase_13 AC 282 ms
50,180 KB
権限があれば一括ダウンロードができます

ソースコード

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