結果
問題 | No.273 回文分解 |
ユーザー | Tsukasa_Type |
提出日時 | 2018-02-14 20:57:17 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 583 bytes |
コンパイル時間 | 2,020 ms |
コンパイル使用メモリ | 71,584 KB |
実行使用メモリ | 58,208 KB |
最終ジャッジ日時 | 2023-08-24 20:12:29 |
合計ジャッジ時間 | 8,358 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 117 ms
55,656 KB |
testcase_02 | AC | 115 ms
55,720 KB |
testcase_03 | AC | 115 ms
55,524 KB |
testcase_04 | WA | - |
testcase_05 | AC | 117 ms
55,876 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 119 ms
55,908 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 119 ms
55,864 KB |
testcase_15 | AC | 115 ms
56,112 KB |
testcase_16 | AC | 116 ms
55,852 KB |
testcase_17 | AC | 115 ms
55,944 KB |
testcase_18 | AC | 117 ms
55,820 KB |
testcase_19 | AC | 118 ms
55,616 KB |
testcase_20 | AC | 115 ms
56,056 KB |
testcase_21 | AC | 115 ms
55,652 KB |
testcase_22 | AC | 119 ms
55,628 KB |
testcase_23 | AC | 118 ms
55,704 KB |
testcase_24 | AC | 116 ms
55,180 KB |
testcase_25 | AC | 118 ms
56,408 KB |
testcase_26 | AC | 116 ms
55,644 KB |
testcase_27 | AC | 116 ms
56,084 KB |
testcase_28 | AC | 118 ms
56,384 KB |
testcase_29 | WA | - |
testcase_30 | AC | 116 ms
55,892 KB |
testcase_31 | AC | 114 ms
55,972 KB |
testcase_32 | AC | 114 ms
55,280 KB |
testcase_33 | AC | 116 ms
55,744 KB |
testcase_34 | AC | 115 ms
55,744 KB |
ソースコード
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.next(); int leng = 0; for (int i=2; i<s.length(); i++) { boolean b = false; for (int j=0; j<s.length()-i+1; j++) { b = palindrome(s.substring(j,j+i)); if (b==true) {break;} } if (b==true) {leng = i;} } System.out.println(leng); } static boolean palindrome (String s) { boolean b; StringBuilder sb = new StringBuilder(s); sb.reverse(); b = sb.toString().equals(s)?true:false; return b; } }