結果

問題 No.238 Mr. K's Another Gift
ユーザー HIROPON87069639HIROPON87069639
提出日時 2016-02-22 21:42:54
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 7,144 KB
実行使用メモリ 7,300 KB
最終ジャッジ日時 2023-10-23 19:21:16
合計ジャッジ時間 2,876 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,428 KB
testcase_01 AC 11 ms
6,428 KB
testcase_02 AC 11 ms
6,428 KB
testcase_03 AC 12 ms
6,428 KB
testcase_04 AC 12 ms
6,492 KB
testcase_05 AC 19 ms
7,144 KB
testcase_06 AC 20 ms
7,300 KB
testcase_07 AC 25 ms
7,300 KB
testcase_08 AC 25 ms
7,300 KB
testcase_09 AC 34 ms
7,300 KB
testcase_10 WA -
testcase_11 AC 11 ms
6,428 KB
testcase_12 AC 11 ms
6,428 KB
testcase_13 AC 12 ms
6,440 KB
testcase_14 AC 19 ms
6,780 KB
testcase_15 AC 31 ms
7,300 KB
testcase_16 AC 30 ms
7,300 KB
testcase_17 AC 14 ms
7,300 KB
testcase_18 AC 16 ms
7,300 KB
testcase_19 AC 14 ms
7,300 KB
testcase_20 AC 12 ms
6,428 KB
testcase_21 AC 11 ms
6,428 KB
testcase_22 AC 12 ms
6,428 KB
testcase_23 AC 11 ms
6,428 KB
testcase_24 AC 13 ms
6,476 KB
testcase_25 AC 14 ms
6,516 KB
testcase_26 AC 20 ms
7,300 KB
testcase_27 AC 31 ms
7,300 KB
testcase_28 AC 20 ms
7,300 KB
testcase_29 AC 32 ms
7,300 KB
testcase_30 WA -
testcase_31 AC 11 ms
6,428 KB
testcase_32 AC 11 ms
6,428 KB
testcase_33 AC 12 ms
6,504 KB
testcase_34 AC 13 ms
7,212 KB
testcase_35 AC 28 ms
7,300 KB
testcase_36 AC 18 ms
7,300 KB
testcase_37 AC 20 ms
7,300 KB
testcase_38 AC 16 ms
7,300 KB
testcase_39 AC 14 ms
7,300 KB
testcase_40 AC 11 ms
6,428 KB
testcase_41 AC 11 ms
6,428 KB
testcase_42 AC 11 ms
6,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

def kai(S):
    cnts = 0
    cntf = len(S)-1
    while cnts <= cntf :
        if S[cnts] != S[cntf]:
            return 0
        cnts += 1
        cntf -= 1
    return 1



S = list(raw_input())
if len(S) == 1:
    print "".join(S*2)
    exit()
if kai(S):
    n = len(S) / 2
    S.insert(n ,S[n])
    print "".join(S)
    exit()

cnts = 0
cntf = len(S)-1
while cnts <= cntf :
    if S[cnts] != S[cntf]:
        if S[cnts +1] == S[cntf]:
            S.insert(cntf+1, S[cnts])
            if kai(S):
                print "".join(S)
                exit()
            else:
                print "NA"
                exit()
            exit()
        elif S[cnts] == S[cntf-1]:
            S.insert(cnts, S[cntf])
            if kai(S):
                print "".join(S)
                exit()
            else:
                print "NA"
                exit()
    cnts += 1
    cntf -= 1
0