結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-07 18:17:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 350 bytes |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-07 20:10:31 |
| 合計ジャッジ時間 | 1,904 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
def ispalindrome(s):
for i in range(len(s)//2):
if s[i] != s[-(i+1)]:
return False
return True
S = input()
N = len(S)
ans = 1
for length in range(N-1, 1, -1):
for p in range(N-length+1):
if ispalindrome(S[p:p+length]):
ans = length
break
else:
continue
break
print(ans)