結果
| 問題 |
No.2234 palindromer
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-10-16 01:23:04 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 559 bytes |
| コンパイル時間 | 3,034 ms |
| コンパイル使用メモリ | 282,332 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-16 01:23:09 |
| 合計ジャッジ時間 | 4,208 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline bool is_palindrome(const string& s) {
string t = s;
reverse(t.begin(), t.end());
return s == t;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
string s;
cin >> s;
string t = s;
reverse(t.begin(), t.end());
string ans = s + t;
for (int i = 0; i <= t.size(); ++i) {
string u = s + t.substr(i);
if (is_palindrome(u)) ans = u;
}
cout << ans << '\n';
return 0;
}
a01sa01to