結果

問題 No.1168 Digit Sum Sequence
コンテスト
ユーザー semisagi
提出日時 2020-08-14 21:22:09
言語 Swift
(6.2.4)
コンパイル:
swiftc _filename_ -Ounchecked -o a.out
実行:
./a.out
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 643 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,619 ms
コンパイル使用メモリ 143,624 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2026-04-26 14:21:08
合計ジャッジ時間 8,564 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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()
print((N - 1) % 9 + 1)
0