結果

問題 No.1587 012 Matrix
ユーザー 👑 箱
提出日時 2021-07-08 23:43:07
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 464 ms / 1,000 ms
コード長 828 bytes
コンパイル時間 15,137 ms
コンパイル使用メモリ 417,088 KB
実行使用メモリ 58,420 KB
最終ジャッジ日時 2023-09-14 05:43:33
合計ジャッジ時間 26,054 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 298 ms
54,036 KB
testcase_01 AC 294 ms
53,948 KB
testcase_02 AC 293 ms
53,980 KB
testcase_03 AC 298 ms
54,020 KB
testcase_04 AC 299 ms
54,124 KB
testcase_05 AC 302 ms
54,028 KB
testcase_06 AC 301 ms
53,856 KB
testcase_07 AC 298 ms
54,028 KB
testcase_08 AC 301 ms
53,964 KB
testcase_09 AC 316 ms
58,044 KB
testcase_10 AC 320 ms
56,196 KB
testcase_11 AC 337 ms
56,828 KB
testcase_12 AC 344 ms
56,872 KB
testcase_13 AC 354 ms
56,904 KB
testcase_14 AC 428 ms
58,032 KB
testcase_15 AC 435 ms
58,236 KB
testcase_16 AC 447 ms
58,376 KB
testcase_17 AC 464 ms
58,108 KB
testcase_18 AC 453 ms
58,420 KB
testcase_19 AC 454 ms
58,320 KB
testcase_20 AC 459 ms
58,268 KB
testcase_21 AC 450 ms
58,408 KB
testcase_22 AC 299 ms
54,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n) { IntArray(n) { 0 } }
    for (k in 0 until n step 2) {
        for (i in k until n) {
            a[k][i] = 2
            a[i][k] = 2
        }
        a[k][k + 1] = 1
    }
    a.forEach { println(it.joinToString("")) }
}

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