結果

問題 No.1168 Digit Sum Sequence
ユーザー Maboy
提出日時 2021-06-20 10:33:12
言語 Swift
(6.0.3)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 188 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 126,128 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2024-06-22 22:27:08
合計ジャッジ時間 2,146 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

var n = String(readLine()!)
while n.count > 1{
    let a = Array(n)
    let b = a.map{String($0)}
    let c = b.map{Int($0)!}
    let d = c.reduce(0) {$0 + $1}
    n = String(d)
}
print(n)
0