結果

問題 No.238 Mr. K's Another Gift
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-06 23:27:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,456 KB
最終ジャッジ日時 2023-09-22 09:10:59
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 15 ms
7,876 KB
testcase_03 AC 14 ms
7,788 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 16 ms
8,260 KB
testcase_06 AC 33 ms
8,068 KB
testcase_07 AC 21 ms
8,296 KB
testcase_08 AC 21 ms
8,336 KB
testcase_09 AC 29 ms
8,456 KB
testcase_10 AC 15 ms
7,828 KB
testcase_11 AC 14 ms
7,868 KB
testcase_12 AC 14 ms
7,968 KB
testcase_13 AC 15 ms
7,792 KB
testcase_14 AC 19 ms
8,188 KB
testcase_15 AC 26 ms
8,356 KB
testcase_16 AC 27 ms
8,396 KB
testcase_17 AC 16 ms
8,380 KB
testcase_18 AC 18 ms
8,412 KB
testcase_19 AC 15 ms
8,236 KB
testcase_20 AC 17 ms
7,940 KB
testcase_21 AC 14 ms
7,864 KB
testcase_22 AC 15 ms
7,844 KB
testcase_23 AC 15 ms
7,832 KB
testcase_24 AC 16 ms
7,964 KB
testcase_25 AC 16 ms
8,012 KB
testcase_26 AC 33 ms
8,048 KB
testcase_27 AC 26 ms
8,424 KB
testcase_28 AC 31 ms
8,180 KB
testcase_29 AC 28 ms
8,384 KB
testcase_30 AC 15 ms
7,824 KB
testcase_31 AC 15 ms
7,836 KB
testcase_32 AC 15 ms
7,828 KB
testcase_33 AC 15 ms
7,976 KB
testcase_34 AC 15 ms
8,140 KB
testcase_35 AC 24 ms
8,344 KB
testcase_36 AC 16 ms
8,360 KB
testcase_37 AC 20 ms
8,428 KB
testcase_38 AC 16 ms
8,316 KB
testcase_39 AC 15 ms
8,196 KB
testcase_40 AC 15 ms
7,892 KB
testcase_41 AC 15 ms
7,924 KB
testcase_42 AC 15 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input().strip()

head = 0
tail = len(s) - 1

while head < tail:
    if s[head] == s[tail]:
        head += 1
        tail -= 1
        continue
    news = s[:head] + s[tail] + s[head:]
    if news == news[::-1]:
        print(news)
        break
    news = s[:tail+1] + s[head] + s[tail + 1:]
    if news == news[::-1]:
        print(news)
        break
    print('NA')
    break
else:
    mid = len(s) // 2
    news = s[:mid] + s[mid] + s[mid:]
    print(news)
0