結果

問題 No.729 文字swap
ユーザー YukicoderAYukicoderA
提出日時 2018-11-17 18:10:47
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 122,096 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-05-07 17:54:17
合計ジャッジ時間 1,341 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

var text = readLine()!
        let index1 = Int(readLine()!)!
        let index2 = Int(readLine()!)!
        let idx1 = text.index(text.startIndex, offsetBy: index1)
        let idx2 = text.index(text.startIndex, offsetBy: index2)
        let w1 = text[idx1]
        let w2 = text[idx2]
        let txt = String(w2)
        text.replaceSubrange(idx1..<text.index(idx1, offsetBy: 1), with: "")
        text.replaceSubrange(idx2..<text.index(idx2, offsetBy: 1), with: "")
        print(text)
0