結果

問題 No.1412 Super Ryuo
ユーザー 👑 箱星箱星
提出日時 2021-02-28 21:43:30
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 13,917 ms
コンパイル使用メモリ 429,564 KB
実行使用メモリ 54,436 KB
最終ジャッジ日時 2024-04-12 10:37:46
合計ジャッジ時間 14,007 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 248 ms
54,200 KB
testcase_01 AC 235 ms
54,420 KB
testcase_02 AC 245 ms
54,436 KB
testcase_03 AC 243 ms
54,376 KB
testcase_04 AC 244 ms
54,188 KB
testcase_05 AC 238 ms
54,400 KB
testcase_06 AC 242 ms
54,224 KB
testcase_07 AC 237 ms
54,372 KB
testcase_08 AC 238 ms
54,296 KB
testcase_09 AC 236 ms
54,316 KB
testcase_10 AC 239 ms
54,372 KB
testcase_11 AC 253 ms
54,372 KB
testcase_12 AC 242 ms
54,328 KB
testcase_13 AC 237 ms
54,104 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