結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2017-07-05 02:02:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 140 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-05 16:26:22 |
合計ジャッジ時間 | 1,922 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 12 |
ソースコード
S=input() a=0 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==2 and len (S)==2: a=1 print(a)