結果
問題 | No.588 空白と回文 |
ユーザー | YamaKasa |
提出日時 | 2018-09-25 15:02:43 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 2,115 ms |
コンパイル使用メモリ | 75,248 KB |
実行使用メモリ | 56,320 KB |
最終ジャッジ日時 | 2024-04-15 04:14:21 |
合計ジャッジ時間 | 5,540 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 102 ms
52,800 KB |
testcase_01 | AC | 100 ms
52,944 KB |
testcase_02 | AC | 110 ms
54,240 KB |
testcase_03 | AC | 126 ms
53,984 KB |
testcase_04 | AC | 99 ms
52,800 KB |
testcase_05 | AC | 103 ms
52,868 KB |
testcase_06 | AC | 117 ms
53,928 KB |
testcase_07 | AC | 112 ms
53,868 KB |
testcase_08 | AC | 100 ms
52,704 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 110 ms
52,660 KB |
testcase_12 | AC | 120 ms
54,128 KB |
testcase_13 | WA | - |
testcase_14 | AC | 101 ms
52,868 KB |
testcase_15 | WA | - |
testcase_16 | AC | 112 ms
53,860 KB |
testcase_17 | AC | 122 ms
54,280 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 123 ms
54,196 KB |
testcase_21 | AC | 122 ms
53,820 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 110 ms
54,024 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); int l = S.length(); char[]c1 = new char[l]; char[]c2 = new char[l]; for(int i = 0; i < l; i++) { c1[i] = S.charAt(i); c2[i] = S.charAt(l - i - 1); } int max = 0; for(int i = 0; i < l; i++) { int cnt = 0; for(int j = i; j < l; j++) { if(c1[j] == c2[j - i]) { cnt++; } } max = Math.max(max, cnt); } System.out.println(max); } }