結果

問題 No.238 Mr. K's Another Gift
ユーザー takakintakakin
提出日時 2020-06-25 22:57:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2023-09-16 23:07:47
合計ジャッジ時間 3,399 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,880 KB
testcase_04 AC 17 ms
7,776 KB
testcase_05 AC 23 ms
8,388 KB
testcase_06 AC 28 ms
8,248 KB
testcase_07 AC 29 ms
8,300 KB
testcase_08 AC 29 ms
8,268 KB
testcase_09 AC 37 ms
8,224 KB
testcase_10 AC 16 ms
7,928 KB
testcase_11 AC 16 ms
7,860 KB
testcase_12 AC 16 ms
7,784 KB
testcase_13 AC 17 ms
7,912 KB
testcase_14 AC 24 ms
8,144 KB
testcase_15 AC 35 ms
8,232 KB
testcase_16 AC 35 ms
8,136 KB
testcase_17 AC 17 ms
8,384 KB
testcase_18 AC 20 ms
8,416 KB
testcase_19 AC 17 ms
8,128 KB
testcase_20 AC 16 ms
7,880 KB
testcase_21 AC 16 ms
7,756 KB
testcase_22 AC 16 ms
7,884 KB
testcase_23 AC 16 ms
7,884 KB
testcase_24 AC 17 ms
7,708 KB
testcase_25 AC 18 ms
8,092 KB
testcase_26 AC 28 ms
8,100 KB
testcase_27 AC 34 ms
8,340 KB
testcase_28 AC 30 ms
8,176 KB
testcase_29 AC 36 ms
8,252 KB
testcase_30 AC 17 ms
7,844 KB
testcase_31 AC 16 ms
7,776 KB
testcase_32 AC 16 ms
7,852 KB
testcase_33 AC 17 ms
7,980 KB
testcase_34 AC 17 ms
8,248 KB
testcase_35 AC 31 ms
8,308 KB
testcase_36 AC 20 ms
8,448 KB
testcase_37 AC 26 ms
8,416 KB
testcase_38 AC 20 ms
8,412 KB
testcase_39 AC 16 ms
8,128 KB
testcase_40 AC 16 ms
7,924 KB
testcase_41 AC 16 ms
7,908 KB
testcase_42 AC 16 ms
7,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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:])
0