CF2199B Two Towers

不知道为什么只能用kotlin提交,第一次尝试写


fun main() = Scanner(System.`in`).run {
    val n = nextLine().toInt()
    repeat(n) {
        val a = nextInt()
        val b = nextInt()
        val c = nextInt()
        val d = nextInt()
        var cnt = c + d - a - b
        if (maxOf(a, b) < minOf(c, d)) {
            cnt -= minOf(c, d) - maxOf(a, b)
        }
        println(cnt)
    }
    close()
}
posted @ 2026-03-31 17:22  kayaker  阅读(1)  评论(0)    收藏  举报