結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-07-06 03:55:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,290 bytes |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 85,868 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 01:16:44 |
| 合計ジャッジ時間 | 2,441 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
bool kai(string s){
int Len = s.size();
for(int i=0;i<Len/2;++i){
if(s[i] != s[Len-1-i]){
return false;
}
}
return true;
}
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(6);//
string s;
cin>>s;
int Len = s.size();
bool odd = false;
if( (Len+1) %2 == 1){
odd = true;
}
int miss=0;
string temp;
for(int i=0; i<Len/2;++i){
if(s[i] != s[Len-1-i] ){
temp = s;
//i-
temp.insert(i,1,s[Len-1-i]);
if(kai(temp) == true){
P(temp);
return 0;
}
temp = s;
temp.insert(Len-1-i+1,1,s[i]);
if(kai(temp) == true){
P(temp);
return 0;
}
P("NA");
return 0;
}
}
if(odd == true){
temp = s;
temp.insert( Len/2,1,'a');
P(temp);
}else{
temp = s;
temp.insert( (Len/2),1,s[Len/2]);
P(temp);
}
return 0;
}
IL_msta