結果
| 問題 | No.729 文字swap |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-21 21:23:34 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 535 bytes |
| 記録 | |
| コンパイル時間 | 1,466 ms |
| コンパイル使用メモリ | 83,896 KB |
| 実行使用メモリ | 43,372 KB |
| 最終ジャッジ日時 | 2026-08-30 18:01:27 |
| 合計ジャッジ時間 | 3,674 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 RE * 2 |
| other | WA * 6 RE * 5 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] str = sc.next().split("");
int from = sc.nextInt();
int to = sc.nextInt();
// 入れ替える文字を対比
String fromStr = str[from + 1];
String toStr = str[to + 1];
// 文字入れ替え
str[from] = toStr;
str[to] = fromStr;
String res = String.join(",", str);
System.out.println(res);
}
}