結果

問題 No.238 Mr. K's Another Gift
ユーザー titiatitia
提出日時 2022-07-31 01:10:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 8,528 KB
最終ジャッジ日時 2023-09-28 03:45:34
合計ジャッジ時間 4,436 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 15 ms
7,912 KB
testcase_02 AC 15 ms
8,068 KB
testcase_03 AC 16 ms
7,928 KB
testcase_04 AC 18 ms
7,708 KB
testcase_05 AC 31 ms
8,324 KB
testcase_06 AC 47 ms
8,128 KB
testcase_07 AC 40 ms
8,192 KB
testcase_08 AC 41 ms
8,308 KB
testcase_09 AC 56 ms
8,056 KB
testcase_10 AC 15 ms
8,068 KB
testcase_11 AC 15 ms
8,032 KB
testcase_12 AC 15 ms
8,088 KB
testcase_13 AC 16 ms
8,104 KB
testcase_14 AC 26 ms
8,188 KB
testcase_15 AC 44 ms
8,076 KB
testcase_16 AC 44 ms
8,144 KB
testcase_17 AC 17 ms
8,436 KB
testcase_18 AC 22 ms
8,284 KB
testcase_19 AC 16 ms
8,076 KB
testcase_20 AC 15 ms
8,068 KB
testcase_21 AC 16 ms
8,112 KB
testcase_22 AC 15 ms
7,852 KB
testcase_23 AC 16 ms
8,120 KB
testcase_24 AC 18 ms
8,120 KB
testcase_25 AC 19 ms
7,968 KB
testcase_26 AC 46 ms
8,240 KB
testcase_27 AC 51 ms
8,232 KB
testcase_28 AC 46 ms
8,196 KB
testcase_29 AC 52 ms
8,128 KB
testcase_30 AC 16 ms
7,992 KB
testcase_31 AC 15 ms
7,932 KB
testcase_32 AC 15 ms
8,096 KB
testcase_33 AC 17 ms
8,112 KB
testcase_34 AC 16 ms
8,160 KB
testcase_35 AC 40 ms
8,220 KB
testcase_36 AC 21 ms
8,528 KB
testcase_37 AC 30 ms
8,192 KB
testcase_38 AC 20 ms
8,320 KB
testcase_39 AC 16 ms
8,032 KB
testcase_40 AC 16 ms
8,004 KB
testcase_41 AC 15 ms
7,848 KB
testcase_42 AC 15 ms
7,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(X):
    for i in range(len(X)):
        if X[i]!=X[len(X)-1-i]:
            return False
    return True
    
S=input()

if check(S)==True:
    X=S[:len(S)//2]+S[len(S)//2]+S[len(S)//2:]

    if check(X)==True:
        print(X)
    else:
        print("NA")

else:
    for i in range(len(S)):
        if S[i]!=S[len(S)-1-i]:
            X=S[:i]+S[len(S)-1-i]+S[i:]
            #print(X)

            if check(X)==True:
                print(X)
                exit()

            X=S[:len(S)-1-i+1]+S[i]+S[len(S)-1-i+1:]
            #print(X)

            if check(X)==True:
                print(X)
                exit()

            print("NA")
            exit()
            
    
0