結果

問題 No.273 回文分解
ユーザー keymoon
提出日時 2025-03-11 23:44:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 809 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-03-11 23:44:39
合計ジャッジ時間 2,732 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

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 ans == length:
        ans -= 2
    
    print(ans)
    
    
if __name__ == '__main__':
    main()
0