結果

問題 No.238 Mr. K's Another Gift
ユーザー nebukuro09nebukuro09
提出日時 2016-10-22 23:20:46
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 77,728 KB
実行使用メモリ 79,156 KB
最終ジャッジ日時 2023-08-15 11:10:07
合計ジャッジ時間 5,980 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
76,160 KB
testcase_01 AC 78 ms
76,420 KB
testcase_02 AC 76 ms
76,584 KB
testcase_03 AC 76 ms
76,312 KB
testcase_04 AC 81 ms
77,336 KB
testcase_05 AC 84 ms
78,748 KB
testcase_06 AC 82 ms
78,580 KB
testcase_07 AC 85 ms
78,860 KB
testcase_08 AC 86 ms
78,804 KB
testcase_09 AC 87 ms
78,864 KB
testcase_10 AC 76 ms
76,652 KB
testcase_11 AC 76 ms
76,268 KB
testcase_12 AC 76 ms
76,240 KB
testcase_13 AC 78 ms
76,168 KB
testcase_14 AC 85 ms
78,472 KB
testcase_15 AC 85 ms
78,940 KB
testcase_16 AC 87 ms
79,156 KB
testcase_17 AC 83 ms
78,616 KB
testcase_18 AC 84 ms
78,824 KB
testcase_19 AC 76 ms
76,384 KB
testcase_20 AC 76 ms
76,656 KB
testcase_21 AC 76 ms
76,488 KB
testcase_22 AC 76 ms
76,156 KB
testcase_23 AC 75 ms
76,132 KB
testcase_24 AC 85 ms
78,676 KB
testcase_25 AC 84 ms
78,676 KB
testcase_26 AC 83 ms
78,640 KB
testcase_27 AC 87 ms
78,752 KB
testcase_28 AC 82 ms
78,572 KB
testcase_29 AC 87 ms
78,916 KB
testcase_30 AC 79 ms
76,152 KB
testcase_31 AC 76 ms
76,212 KB
testcase_32 AC 76 ms
76,224 KB
testcase_33 AC 82 ms
78,472 KB
testcase_34 AC 77 ms
76,424 KB
testcase_35 AC 86 ms
78,840 KB
testcase_36 AC 84 ms
79,028 KB
testcase_37 AC 84 ms
78,940 KB
testcase_38 AC 86 ms
78,896 KB
testcase_39 AC 78 ms
76,508 KB
testcase_40 AC 76 ms
76,212 KB
testcase_41 AC 77 ms
76,260 KB
testcase_42 AC 76 ms
76,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_kaibun(s):
    return all(s[i]==s[-i-1] for i in xrange(len(s)/2))

S = raw_input()
if is_kaibun(S):
    m = len(S)/2
    print S[:m]+S[m]+S[m:]
    exit()
for i in xrange(len(S)/2):
    j = len(S)-i-1
    if S[i] != S[j]:
        T = S[:i]+S[j]+S[i:]
        if is_kaibun(T):
            print T
            exit()
        T = S[:i+1]+S[j]+S[i+1:]
        if is_kaibun(T):
            print T
            exit()
        T = S[:j]+S[i]+S[j:]
        if is_kaibun(T):
            print T
            exit()
        T = S[:j+1]+S[i]+S[j+1:]
        if is_kaibun(T):
            print T
            exit()
        print 'NA'
        exit()
print 'NA'
0