結果

問題 No.729 文字swap
ユーザー Maeda
提出日時 2025-08-25 17:05:59
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 2,754 ms
コンパイル使用メモリ 76,244 KB
実行使用メモリ 46,504 KB
最終ジャッジ日時 2025-08-25 17:06:05
合計ジャッジ時間 5,614 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		int change1 = scan.nextInt();
		int change2 = scan.nextInt();
		for(int i = 0 ; i < str.length() ; i++){
			if(i == change1){
				System.out.print(str.charAt(change2));
			}else if(i == change2){
				System.out.print(str.charAt(change1));
			}else{
				System.out.print(str.charAt(i));
			}
		}
		
    }
}
0