結果
| 問題 | No.238 Mr. K's Another Gift |
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-09-01 17:31:29 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 525 bytes |
| 記録 | |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 77,588 KB |
| 最終ジャッジ日時 | 2025-12-03 16:31:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / 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_