結果

問題 No.2234 palindromer
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-03-03 23:43:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 203,876 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 03:47:00
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
bool isP(string s) {
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
}
int main () {
    string s;
    cin >> s;
    string r = s;
    reverse(r.begin(), r.end());
    for (int i = s.size() - 1; i >= 0; i --) {
        string t = s + r.substr(i, s.size() - i);
        if (isP(t)) {
            cout << t << endl;
            return 0;
        }
    }
}
0