結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-07 18:17:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 350 bytes |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 53,504 KB |
| 最終ジャッジ日時 | 2024-07-07 20:11:13 |
| 合計ジャッジ時間 | 2,371 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)