結果
問題 |
No.273 回文分解
|
ユーザー |
|
提出日時 | 2025-03-11 23:27:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 877 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2025-03-11 23:27:33 |
合計ジャッジ時間 | 2,912 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 9 WA * 23 |
ソースコード
def main(): inp = input() num = [] count = 0 ans = 1 length = len(inp) check = 0 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 check += 1 else: wid += 1 else: if inp[count : count + wid // 2 ] == inp[count + wid - 1 : count + wid // 2 : -1]: ans = wid wid += 1 check += 1 else: wid += 1 count += 1 if check >= 2: ans = 1 print(ans) if __name__ == '__main__': main()