結果

問題 No.729 文字swap
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2019-02-19 18:15:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 504 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 74,588 KB
実行使用メモリ 41,480 KB
最終ジャッジ日時 2024-04-20 17:13:26
合計ジャッジ時間 4,420 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,480 KB
testcase_01 AC 115 ms
40,844 KB
testcase_02 AC 122 ms
41,304 KB
testcase_03 AC 131 ms
41,452 KB
testcase_04 AC 110 ms
39,920 KB
testcase_05 AC 125 ms
41,220 KB
testcase_06 AC 128 ms
41,308 KB
testcase_07 AC 113 ms
40,076 KB
testcase_08 AC 124 ms
41,288 KB
testcase_09 AC 125 ms
41,472 KB
testcase_10 AC 130 ms
41,424 KB
testcase_11 AC 117 ms
40,156 KB
testcase_12 AC 126 ms
41,452 KB
testcase_13 AC 126 ms
41,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = sc.nextInt();
        int j = sc.nextInt();
        System.out.println(exchange(s,i,j));
    }
    
    static String exchange(String s, int i, int j) {
        char [] arr = s.toCharArray();
        char tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
        return String.valueOf(arr);
    }
}
0