結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー Keito IdaKeito Ida
提出日時 2021-08-05 19:07:24
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 1,236 ms
コンパイル使用メモリ 131,800 KB
実行使用メモリ 8,472 KB
最終ジャッジ日時 2023-10-14 21:39:18
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,360 KB
testcase_01 AC 3 ms
8,224 KB
testcase_02 AC 3 ms
8,320 KB
testcase_03 AC 3 ms
8,372 KB
testcase_04 AC 3 ms
8,472 KB
testcase_05 AC 3 ms
8,272 KB
testcase_06 AC 3 ms
8,336 KB
testcase_07 AC 3 ms
8,280 KB
testcase_08 AC 4 ms
8,236 KB
testcase_09 AC 3 ms
8,240 KB
権限があれば一括ダウンロードができます

ソースコード

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