結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
HIROPON87069639
|
| 提出日時 | 2016-02-22 21:42:54 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 912 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2024-09-22 13:06:06 |
| 合計ジャッジ時間 | 2,888 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 2 |
ソースコード
# -*- 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
HIROPON87069639