結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-09-01 17:31:29 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 525 bytes |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-07-18 17:29:55 |
| 合計ジャッジ時間 | 3,344 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
def is_palindromic(s):
L = len(s)
for i in xrange(L/2):
if s[i] != s[L-1-i]:
return False
return True
S = raw_input()
L = len(S)
for i in xrange(L/2):
if S[i] != S[L-1-i]:
sol0 = S[:L-i] + S[i] + S[L-i:]
if is_palindromic(sol0):
print(sol0)
quit()
sol1 = S[:i] + S[L-1-i] + S[i:]
if is_palindromic(sol1):
print(sol1)
quit()
print('NA')
quit()
center = S[L/2]
print(S[:L/2] + center + S[L/2:])
tnoda_