結果

問題 No.273 回文分解
ユーザー ぴろずぴろず
提出日時 2015-08-28 22:24:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 55,984 KB
最終ジャッジ日時 2023-09-07 19:37:14
合計ジャッジ時間 7,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,628 KB
testcase_01 AC 118 ms
55,620 KB
testcase_02 AC 118 ms
55,428 KB
testcase_03 AC 115 ms
55,536 KB
testcase_04 AC 115 ms
55,372 KB
testcase_05 AC 115 ms
55,588 KB
testcase_06 AC 119 ms
55,472 KB
testcase_07 AC 113 ms
55,584 KB
testcase_08 AC 114 ms
55,424 KB
testcase_09 AC 117 ms
53,384 KB
testcase_10 AC 117 ms
55,524 KB
testcase_11 AC 118 ms
55,796 KB
testcase_12 AC 115 ms
53,592 KB
testcase_13 AC 115 ms
55,520 KB
testcase_14 AC 115 ms
55,428 KB
testcase_15 AC 119 ms
55,440 KB
testcase_16 AC 118 ms
55,588 KB
testcase_17 AC 115 ms
55,844 KB
testcase_18 AC 119 ms
55,584 KB
testcase_19 AC 117 ms
55,616 KB
testcase_20 AC 117 ms
55,492 KB
testcase_21 AC 117 ms
55,232 KB
testcase_22 AC 114 ms
55,388 KB
testcase_23 AC 120 ms
55,648 KB
testcase_24 AC 116 ms
55,324 KB
testcase_25 AC 115 ms
55,460 KB
testcase_26 AC 117 ms
55,984 KB
testcase_27 AC 113 ms
55,544 KB
testcase_28 AC 110 ms
55,464 KB
testcase_29 AC 114 ms
55,532 KB
testcase_30 AC 115 ms
55,696 KB
testcase_31 AC 115 ms
55,596 KB
testcase_32 AC 115 ms
55,908 KB
testcase_33 AC 116 ms
55,332 KB
testcase_34 AC 115 ms
55,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no273;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int n = s.length;
		int ans = 0;
		for(int i=0;i<n;i++) {
			LOOP: for(int j=i;j<n;j++) {
				for(int k=i;k<=j;k++) {
					if (s[k] != s[j-(k-i)]) {
						continue LOOP;
					}
				}
				int len = j - i + 1;
				if (len < n) {
					ans = Math.max(ans,len);
				}
			}
		}
		System.out.println(ans);
	}

}
0