結果
| 問題 | 
                            No.238 Mr. K's Another Gift
                             | 
                    
| コンテスト | |
| ユーザー | 
                             syoken_desuka
                         | 
                    
| 提出日時 | 2015-07-05 23:58:23 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,491 bytes | 
| コンパイル時間 | 813 ms | 
| コンパイル使用メモリ | 85,748 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 01:07:19 | 
| 合計ジャッジ時間 | 5,209 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 20 WA * 20 | 
ソースコード
#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 << "NO" << endl;
    return 0;
}
            
            
            
        
            
syoken_desuka