結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー AsahiAsahi
提出日時 2023-02-03 23:12:05
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,542 bytes
コンパイル時間 2,657 ms
コンパイル使用メモリ 78,600 KB
実行使用メモリ 55,872 KB
最終ジャッジ日時 2023-09-15 19:25:52
合計ジャッジ時間 7,085 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,584 KB
testcase_01 AC 114 ms
55,872 KB
testcase_02 AC 117 ms
55,804 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;

public class Main{
    /* 入出力 */
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    /* 定数 */
    static final int [] y4 = {0,1,0,-1};
    static final int [] x4 = {1,0,-1,0};
    static final int  INF1 = Integer.MAX_VALUE;
    static final long INF2 = Long.MAX_VALUE;
    static final long MOD1 = (long)1e9+7;
    static final long MOD2 = 998244353;
    /* Main */
    public static void main(String[] args) throws IOException{
        String S = sc.next();
        int max = -INF1;
        for(int i=S.length();i>=1;i--) { //i以上で分割
            StringBuilder sb = new StringBuilder();
            int len = 0;
            for(int s=0;s<S.length();s++) {
                sb.append(S.substring(s,s+1));
                if(i <= sb.length()) {
                    String base = sb.toString();
                    String reve = sb.reverse().toString();
                    sb.reverse();
                    if(base.equals(reve)) {
                        len += base.length();
                        sb.delete(0,sb.length());
                    }
                }
            }
            if(len == S.length()) {
                max = i;
                break;
            }
        }
        output.print(max);
        output.flush();        
    }
}
0