結果

問題 No.2234 palindromer
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-03-03 23:41:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 3,741 ms
コンパイル使用メモリ 203,212 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 03:46:56
合計ジャッジ時間 3,263 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 = 0; i < s.size(); i ++) {
        string t = s + r.substr(0, i);
        if (isP(t)) {
            cout << t << endl;
            return 0;
        }
    }
}
0