結果

問題 No.400 鏡
ユーザー jimanojimano
提出日時 2018-01-20 12:38:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 2,744 ms
コンパイル使用メモリ 71,988 KB
実行使用メモリ 49,588 KB
最終ジャッジ日時 2023-08-26 08:47:28
合計ジャッジ時間 4,697 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,464 KB
testcase_01 AC 39 ms
49,260 KB
testcase_02 AC 40 ms
49,588 KB
testcase_03 AC 39 ms
49,184 KB
testcase_04 AC 38 ms
49,312 KB
testcase_05 AC 39 ms
49,308 KB
testcase_06 AC 40 ms
49,312 KB
testcase_07 AC 39 ms
49,296 KB
testcase_08 AC 39 ms
49,220 KB
testcase_09 AC 39 ms
49,344 KB
testcase_10 AC 41 ms
49,336 KB
testcase_11 AC 38 ms
49,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0400 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			char[] array = br.readLine().toCharArray();
			int length = array.length;
			
			for (int i = 0; i < length / 2; i++) {
				int idx = length - 1 - i;
				if (array[i] == array[idx]) {
					array[i] = (array[i] == '>') ? '<': '>';
					array[idx] = array[i];
				}
			}

			if (length % 2 != 0) {
				char c = array[length / 2];
				array[length / 2] = (c == '>') ? '<': '>';
			}
			System.out.println(array);

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0