結果

問題 No.2234 palindromer
ユーザー ttkkggww
提出日時 2023-03-03 21:56:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 3,939 ms
コンパイル使用メモリ 252,448 KB
最終ジャッジ日時 2025-02-11 02:27:15
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
string s;
bool isp(string s){
	string t = s;
	reverse(t.begin(),t.end());
	return t==s;
}

void solve(){
	int n = s.size();
	for(int i = 0;i<=n;i++){
		if(isp(s)){
			cout<<s<<endl;
			return;
		}
		s.insert(s.begin()+n,s[i]);
	}
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> s;
	solve();
}
0