結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-07-05 04:25:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 518 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-05 16:57:24 |
| 合計ジャッジ時間 | 2,078 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 20 WA * 12 |
ソースコード
S=input()
a=1
i=0
while i < len(S)-2:
if S[i]==S[i+2]:
j=1
c=3
while i-j>=0 and i+j<len(S)-2 and S[i-j]==S[i+2+j]:
c+=2
j+=1
if c>a:
a=c
i+=1
i=0
while i<len(S)-1:
if S[i]==S[i+1]:
j=1
c=2
while i-j>=0 and i+j<len(S)-1 and S[i-j]==S[i+1+j]:
c+=2
j+=1
print(S[i-j])
if c>a:
a=c
i +=1
if a==len (S):
if a==2:
a=1
else:
a-=2
print(a)
rocoder