結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー Keito Ida
提出日時 2021-08-05 19:07:24
言語 Swift
(6.0.3)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 9,540 ms
コンパイル使用メモリ 130,648 KB
実行使用メモリ 9,216 KB
最終ジャッジ日時 2024-09-16 15:22:50
合計ジャッジ時間 10,090 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

// 入力
// 3
// 1 2 0 0 0 0 0 0 0
// 出力
// 221


let n = Int(readLine()!)!
let counts = readLine()!.split(separator: " ").map { Int($0)! }

var str = ""

for num in 1...9 {
    let count = counts[num-1]
    let subStr = String(repeating: String(num), count: count)
    str = subStr + str
}

print(str)
0