結果

問題 No.238 Mr. K's Another Gift
ユーザー naimonon77naimonon77
提出日時 2016-07-24 15:02:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,235 bytes
コンパイル時間 1,387 ms
コンパイル使用メモリ 163,328 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 08:28:45
合計ジャッジ時間 4,496 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 3 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 4 ms
5,376 KB
testcase_27 AC 4 ms
5,376 KB
testcase_28 AC 4 ms
5,376 KB
testcase_29 AC 4 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 4 ms
5,376 KB
testcase_38 AC 4 ms
5,376 KB
testcase_39 AC 4 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

template<typename T>
T combi(T n, T r) {
	T i;
	T rep = 1;
	if (r > n / 2) r = n - r;
	rep(i, r) {
		rep *= n - i;
		rep /= i + 1;
	}
	return rep;
}

signed main(void)
{
	ull i, j, k, l;
	string s;
	cin >> s;
	bool done = false;
	rep(i, s.size()/2) {
		if (s[i] != s[s.size() - 1 - i]) {
			if (s[i] == s[s.size() - 1 - i]) {
				string tmp{ s[s.size() - 1 - i] };
				s.insert(i, tmp);
			}
			else {
				string tmp{ s[i] };
				s.insert(s.size() - i, tmp);
			}
			done = true;
			break;
		}
	}
	if (!done) {
		string tmp{ "a" };
		s.insert(s.size()/2, tmp);
	}

	rep(i, s.size()/2) {
		if (s[i] != s[s.size() - 1 - i]) {
			cout << "NA" << endl;
			return 0;
		}
	}
	cout << s << endl;
	return 0;
}
0