結果

問題 No.1291 小手調べ
ユーザー semisagisemisagi
提出日時 2020-11-20 21:22:24
言語 Swift
(5.4.2)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 4,649 ms
使用メモリ 7,924 KB
最終ジャッジ日時 2023-02-23 17:46:21
合計ジャッジ時間 5,561 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 3 ms
7,732 KB
testcase_01 AC 3 ms
7,924 KB
testcase_02 AC 3 ms
7,912 KB
testcase_03 AC 4 ms
7,836 KB
testcase_04 AC 3 ms
7,856 KB
権限があれば一括ダウンロードができます

ソースコード

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 {
        defer { index += 1 }
        return peek()
    }

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

    mutating func nextInts(_ n: Int) -> [Int] {
        return (0 ..< n).map { _ in nextInt() }
    }

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

var scanner = Scanner()
let N = scanner.nextInt()

for _ in 0 ..< N {
    let d = scanner.nextInt()
    if d == 1 {
        print(10)
    } else {
        print("9" + String(repeating: "0", count: d - 1))
    }
}
0