結果
問題 | No.2234 palindromer |
ユーザー |
|
提出日時 | 2023-03-03 21:30:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 1,620 ms |
コンパイル使用メモリ | 194,684 KB |
最終ジャッジ日時 | 2025-02-11 01:50:02 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define pb push_back using ll = long long; using vi = vector <int>; const ll mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); string s; cin >> s; int n = s.size(); for(int i = 0; i < n; i ++) { string t = s.substr(0, i); reverse(t.begin(), t.end()); t = s + t; string r = t; reverse(r.begin(), r.end()); if(r == t) { cout << t << '\n'; break; } } }