結果

問題 No.1169 Row and Column and Diagonal
ユーザー rutilicusrutilicus
提出日時 2021-02-13 21:29:06
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 11,522 ms
コンパイル使用メモリ 416,632 KB
実行使用メモリ 61,096 KB
最終ジャッジ日時 2023-09-28 07:03:47
合計ジャッジ時間 18,853 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
53,740 KB
testcase_01 AC 281 ms
53,700 KB
testcase_02 AC 276 ms
53,764 KB
testcase_03 AC 275 ms
53,852 KB
testcase_04 AC 274 ms
53,836 KB
testcase_05 AC 286 ms
53,872 KB
testcase_06 AC 339 ms
56,568 KB
testcase_07 AC 363 ms
56,760 KB
testcase_08 AC 426 ms
58,832 KB
testcase_09 AC 440 ms
59,024 KB
testcase_10 AC 472 ms
59,276 KB
testcase_11 AC 475 ms
61,064 KB
testcase_12 AC 468 ms
61,020 KB
testcase_13 AC 465 ms
61,008 KB
testcase_14 AC 475 ms
61,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    val ans = Array(n) { IntArray(n) }

    for (i in 1..n) {
        var current = i
        for (j in i..i + n) {
            ans[i - 1][(j - 1) % n] = current
            current--
            if (current == 0) {
                current = n
            }
        }
    }

    ans.forEach { builder.appendLine(it.joinToString(" ")) }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0