結果

問題 No.729 文字swap
ユーザー fabled2468fabled2468
提出日時 2018-09-23 20:00:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 3,666 ms
コンパイル使用メモリ 72,704 KB
実行使用メモリ 56,232 KB
最終ジャッジ日時 2023-10-12 14:54:01
合計ジャッジ時間 6,563 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,668 KB
testcase_01 AC 121 ms
55,564 KB
testcase_02 AC 123 ms
55,740 KB
testcase_03 AC 124 ms
55,892 KB
testcase_04 AC 124 ms
55,964 KB
testcase_05 AC 124 ms
56,160 KB
testcase_06 AC 124 ms
54,012 KB
testcase_07 AC 124 ms
55,864 KB
testcase_08 AC 124 ms
55,972 KB
testcase_09 AC 127 ms
55,576 KB
testcase_10 AC 125 ms
56,072 KB
testcase_11 AC 125 ms
55,540 KB
testcase_12 AC 123 ms
56,232 KB
testcase_13 AC 124 ms
56,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main_729_swapString {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        String value0 = scan.next();
        int value1 = scan.nextInt();
        int value2 = scan.nextInt();
        scan.close();

        String result = String.join("", swapString(value0, value1, value2));
        System.out.println(result);
    }

    static String[] swapString(String value0, int value1, int value2) {

        String[] textList = value0.split("");

        String targetString1 = textList[value1];
        String targetString2 = textList[value2];

        textList[value2] = targetString1;
        textList[value1] = targetString2;

        return textList;
    }
}
0