結果
問題 | No.238 Mr. K's Another Gift |
ユーザー |
![]() |
提出日時 | 2020-06-25 22:57:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 73 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-07-03 21:54:56 |
合計ジャッジ時間 | 2,920 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() S=input() n=len(S) def chk(T): m=len(T) for i in range(m//2): if T[i]!=T[m-1-i]: return False else: continue else: return True for i in range(n//2): if S[i]==S[n-1-i]: continue else: S1=S[:i]+S[n-1-i]+S[i:] S2=S[:n-i]+S[i]+S[n-i:] if chk(S1): print(S1) elif chk(S2): print(S2) else: print("NA") break else: if n%2: print(S[:n//2]+S[n//2]+S[n//2:]) else: print(S[:n//2]+"a"+S[n//2:])