結果

問題 No.1169 Row and Column and Diagonal
ユーザー semisagisemisagi
提出日時 2020-08-14 21:23:53
言語 Swift
(5.10.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 728 bytes
コンパイル時間 5,170 ms
コンパイル使用メモリ 130,416 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2023-07-31 19:33:38
合計ジャッジ時間 8,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
7,808 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

struct Scanner {
    private var elements = [String]()
    private var index = 0

    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }

    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }

    mutating func nextInt() -> Int {
        return Int(next())!
    }

    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()

let N = scanner.nextInt()
for i in 0 ..< N {
    print((0 ..< N).map({ ($0 + i) % N + 1 }).map(String.init).joined(separator: " "))
}
0