結果

問題 No.39 桁の数字を入れ替え
ユーザー kazu116kazu116
提出日時 2019-05-11 01:54:09
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 1,055 ms
コンパイル使用メモリ 126,624 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2024-05-07 19:04:58
合計ジャッジ時間 2,040 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
8,960 KB
testcase_01 AC 7 ms
8,704 KB
testcase_02 AC 7 ms
8,704 KB
testcase_03 AC 8 ms
8,704 KB
testcase_04 AC 7 ms
8,832 KB
testcase_05 AC 8 ms
8,704 KB
testcase_06 AC 8 ms
8,960 KB
testcase_07 AC 8 ms
8,704 KB
testcase_08 AC 7 ms
8,704 KB
testcase_09 AC 7 ms
8,704 KB
testcase_10 AC 8 ms
8,832 KB
testcase_11 AC 7 ms
8,960 KB
testcase_12 WA -
testcase_13 AC 8 ms
8,832 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

var input:[String] = readLine()!.map{String($0)}

var count = 0
for i in 0 ..< input.count {
    var index:Int = 0
    for j in i+1 ..< input.count {
        if Int(input[i])! < Int(input[j])! {
            index = j
        }
    }
    if index != 0 {
        let a = input[i]
        input[i] = input[index]
        input[index] = a
        break
    }
}
var output:String = ""
for c in input {
    output += c
}
print(output)
0