結果

問題 No.238 Mr. K's Another Gift
ユーザー yaoshimaxyaoshimax
提出日時 2016-02-23 01:33:02
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 612 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 7,104 KB
実行使用メモリ 11,164 KB
最終ジャッジ日時 2023-10-23 19:23:48
合計ジャッジ時間 5,086 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,816 KB
testcase_01 AC 11 ms
6,444 KB
testcase_02 AC 11 ms
6,444 KB
testcase_03 AC 10 ms
6,444 KB
testcase_04 AC 10 ms
6,448 KB
testcase_05 AC 18 ms
6,564 KB
testcase_06 AC 17 ms
6,656 KB
testcase_07 AC 26 ms
6,776 KB
testcase_08 AC 26 ms
6,776 KB
testcase_09 AC 38 ms
6,776 KB
testcase_10 AC 10 ms
6,444 KB
testcase_11 AC 11 ms
6,444 KB
testcase_12 AC 11 ms
6,444 KB
testcase_13 AC 14 ms
6,456 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def palindrone(s):
    left,right=0,len(s)-1
    while left<right:
        if s[left]!=s[right]:
            return False
        left=left+1
        right=right-1
    return True

s=raw_input()
l=len(s)
if palindrone(s):
    print s[:(l/2)]+s[(l/2)]+s[(l/2):]
    exit()
left, right=0,len(s)-1
while left<right:
    if s[left]!=s[right]:
        c1=s[:left]+s[right]+s[left:]
        if palindrone(c1):
            print c1
            exit()
        c2=s[:right+1]+s[left]+s[right+1:]
        if palindrone(c2):
            print c2
            exit()
    left=left+1
    right=right-1
print "NA"
            
0