結果

問題 No.1587 012 Matrix
ユーザー koboshikoboshi
提出日時 2021-07-08 23:43:07
言語 Kotlin
(1.6.10)
結果
AC  
実行時間 404 ms / 1,000 ms
コード長 828 bytes
コンパイル時間 10,391 ms
使用メモリ 56,252 KB
最終ジャッジ日時 2023-02-01 19:29:45
合計ジャッジ時間 19,240 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 236 ms
47,836 KB
testcase_01 AC 248 ms
48,520 KB
testcase_02 AC 242 ms
47,912 KB
testcase_03 AC 238 ms
47,836 KB
testcase_04 AC 240 ms
47,972 KB
testcase_05 AC 238 ms
47,948 KB
testcase_06 AC 244 ms
47,880 KB
testcase_07 AC 238 ms
48,016 KB
testcase_08 AC 252 ms
48,360 KB
testcase_09 AC 262 ms
48,384 KB
testcase_10 AC 274 ms
48,620 KB
testcase_11 AC 276 ms
49,164 KB
testcase_12 AC 279 ms
50,904 KB
testcase_13 AC 300 ms
51,176 KB
testcase_14 AC 351 ms
53,792 KB
testcase_15 AC 357 ms
54,036 KB
testcase_16 AC 372 ms
54,184 KB
testcase_17 AC 369 ms
55,288 KB
testcase_18 AC 381 ms
55,308 KB
testcase_19 AC 387 ms
55,148 KB
testcase_20 AC 404 ms
56,252 KB
testcase_21 AC 397 ms
56,152 KB
testcase_22 AC 239 ms
48,456 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