結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
syoken_desuka
|
| 提出日時 | 2015-07-05 23:59:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,491 bytes |
| コンパイル時間 | 741 ms |
| コンパイル使用メモリ | 85,840 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 01:07:21 |
| 合計ジャッジ時間 | 2,168 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <ostream>
#include<complex>
#include <cmath>
#include <iostream>
#include <stack>
#include <fstream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <string>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
bool search(string s, bool right)
{
string tester(s);
bool filled = false;
rep(i,tester.size()/2) // fill test
{
if (tester[i] != tester[tester.size() - 1 - i])
{
if (right)
{
tester.insert(tester.size()-i,tester.substr(i,1));
}else
{
tester.insert(i,tester.substr(tester.size() - 1 - i,1));
}
filled = true;
break;
}
}
if (!filled)
{
tester.insert(tester.size()/2,tester.substr(tester.size()/2,1));
}
rep(i,tester.size()) // check
{
if (tester[i] != tester[tester.size() -1 - i])
{
return false;
}
}
cout << tester << endl;
return true;
}
int main()
{
string s;
cin >> s;
if (search(s,true))
{
return 0;
}
if (search(s,false))
{
return 0;
}
cout << "NA" << endl;
return 0;
}
syoken_desuka