結果

問題 No.273 回文分解
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-08-28 22:28:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 932 bytes
コンパイル時間 4,619 ms
コンパイル使用メモリ 75,612 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-07 19:37:37
合計ジャッジ時間 9,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,520 KB
testcase_01 AC 123 ms
55,392 KB
testcase_02 AC 122 ms
55,604 KB
testcase_03 AC 121 ms
55,280 KB
testcase_04 AC 118 ms
55,428 KB
testcase_05 AC 122 ms
55,456 KB
testcase_06 AC 122 ms
55,896 KB
testcase_07 AC 120 ms
55,848 KB
testcase_08 AC 126 ms
55,560 KB
testcase_09 AC 123 ms
55,656 KB
testcase_10 AC 123 ms
55,744 KB
testcase_11 AC 122 ms
55,700 KB
testcase_12 AC 121 ms
55,660 KB
testcase_13 AC 122 ms
55,608 KB
testcase_14 AC 126 ms
55,760 KB
testcase_15 AC 122 ms
55,524 KB
testcase_16 AC 120 ms
55,808 KB
testcase_17 AC 121 ms
55,428 KB
testcase_18 AC 120 ms
55,752 KB
testcase_19 AC 123 ms
55,592 KB
testcase_20 AC 123 ms
55,404 KB
testcase_21 AC 123 ms
55,748 KB
testcase_22 AC 124 ms
55,904 KB
testcase_23 AC 125 ms
55,416 KB
testcase_24 AC 124 ms
55,500 KB
testcase_25 AC 125 ms
55,376 KB
testcase_26 AC 126 ms
55,944 KB
testcase_27 AC 125 ms
55,844 KB
testcase_28 AC 123 ms
55,916 KB
testcase_29 AC 124 ms
55,440 KB
testcase_30 AC 124 ms
55,788 KB
testcase_31 AC 121 ms
53,656 KB
testcase_32 AC 120 ms
55,704 KB
testcase_33 AC 121 ms
55,692 KB
testcase_34 AC 119 ms
56,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0273 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		StringBuilder sb = new StringBuilder(in.next());
		int max = 1;
		for (int i=0; i<sb.length(); i++) {
			for (int j=i+1; j<=sb.length(); j++) {
				if (i == 0 && j == sb.length()) continue;
				StringBuilder tmp = new StringBuilder(sb.substring(i,j));
				if (String.valueOf(tmp).equals(tmp.reverse().toString())) {
					max = Math.max(max,j-i);
				}
			}
		}

		out.println(max);
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0