现在的位置: 首页 > 综合 > 正文

CF334A Candy Bags

2013年10月31日 ⁄ 综合 ⁄ 共 255字 ⁄ 字号 评论关闭
object CF334A {
    def main(argv: Array[String]) {
        val n = readLine.toInt
        def output(index: Int): Unit = {
            val a = index
            val b = n * n - index + 1
            if (index % (n >> 1) == 0) {
                if (index == (n * n) >> 1) {
                    println(a + " " + b)
                } else {
                    println(a + " " + b)
                    output(index + 1)
                }
            } else {
                print(a + " " + b + " ")
                output(index + 1)
            }
        }
        output(1)
    }
}

抱歉!评论已关闭.