結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2017-07-05 04:26:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 519 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-25 13:52:48 |
合計ジャッジ時間 | 2,083 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
S=input()a=1i=0while i < len(S)-2:if S[i]==S[i+2]:j=1c=3while i-j>=0 and i+j<len(S)-2 and S[i-j]==S[i+2+j]:c+=2j+=1if c>a:a=ci+=1i=0while i<len(S)-1:if S[i]==S[i+1]:j=1c=2while i-j>=0 and i+j<len(S)-1 and S[i-j]==S[i+1+j]:c+=2j+=1# print(S[i-j])if c>a:a=ci +=1if a==len (S):if a==2:a=1else:a-=2print(a)