結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,428 KB
testcase_01 AC 11 ms
6,428 KB
testcase_02 AC 11 ms
6,428 KB
testcase_03 AC 11 ms
6,428 KB
testcase_04 AC 11 ms
6,492 KB
testcase_05 AC 15 ms
7,144 KB
testcase_06 AC 20 ms
7,300 KB
testcase_07 AC 20 ms
7,300 KB
testcase_08 AC 20 ms
7,300 KB
testcase_09 AC 29 ms
7,300 KB
testcase_10 AC 11 ms
6,428 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 11 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 13 ms
6,516 KB
testcase_26 AC 22 ms
7,300 KB
testcase_27 AC 26 ms
7,300 KB
testcase_28 AC 20 ms
7,300 KB
testcase_29 AC 27 ms
7,300 KB
testcase_30 AC 11 ms
6,428 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
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])
            print "".join(S)
            exit()
        elif S[cnts] == S[cntf-1]:
            S.insert(cnts, S[cntf])
            print "".join(S)
            exit()
        else:
            print "NA"
            exit()
    cnts += 1
    cntf -= 1
0