結果
| 問題 | No.588 空白と回文 |
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2019-11-14 19:19:22 |
| 言語 | Java (openjdk 26.0.2.1 + ac-library) |
| 結果 |
AC
不安定
|
| 実行時間 | 73 ms / 2,000 ms |
| + 323µs | |
| コード長 | 685 bytes |
| 記録 | |
| コンパイル時間 | 3,304 ms |
| コンパイル使用メモリ | 83,940 KB |
| 実行使用メモリ | 46,960 KB |
| 最終ジャッジ日時 | 2026-09-01 22:41:47 |
| 合計ジャッジ時間 | 6,531 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
char[] arr = sc.next().toCharArray();
int max = 1;
for (int i = 0; i < arr.length; i++) {
int count1 = 1;
for (int j = 1; i - j >= 0 && i + j < arr.length; j++) {
if (arr[i - j] == arr[i + j]) {
count1 += 2;
}
}
max = Math.max(max, count1);
int count2 = 0;
for (int j = 0; i - j >= 0 && i + j + 1 < arr.length; j++) {
if (arr[i - j] == arr[i + j + 1]) {
count2 += 2;
}
}
max = Math.max(max, count2);
}
System.out.println(max);
}
}
htensai