結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-11 23:46:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 868 bytes |
| コンパイル時間 | 386 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-03-11 23:46:52 |
| 合計ジャッジ時間 | 2,852 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
def main():
inp = input()
num = []
count = 0
ans = 1
length = len(inp)
for i in inp:
wid = ans
while length - count >= wid:
if wid % 2 == 0:
if inp[count : count + wid // 2] == inp[count + wid -1 : count + wid //2 - 1 : -1]:
ans = wid
wid += 1
else:
wid += 1
else:
if inp[count : count + wid // 2 ] == inp[count + wid - 1 : count + wid // 2 : -1]:
ans = wid
wid += 1
else:
wid += 1
count += 1
if length == 2:
ans = 1
elif ans == length:
ans -= 2
else:
pass
print(ans)
if __name__ == '__main__':
main()