結果

問題 No.2234 palindromer
ユーザー AhmadovAhmadov
提出日時 2023-05-03 01:03:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,440 bytes
コンパイル時間 2,715 ms
コンパイル使用メモリ 256,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 08:40:58
合計ジャッジ時間 3,774 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/*
> Kermit Presents...
*/

#include <bits/stdc++.h>
using namespace std;

#define drop(x) cout<<x<<endl;return;
#define debug(arr,a,b) for(auto v:arr){cout<<v<<a;}cout<<b;
#define print(arr)  for(auto v:arr){cout<<v<<" ";}cout<<"\n";
#define all(arr)    (arr).begin(),(arr).end()
#define sz(s)       (s).size()
#define vi          vector<int>
#define endl        "\n"
#define pb      push_back
#define ins     insert
#define mp      make_pair
#define int     long long int
#define str     string

const int mod = 1e9 + 7;
const int inf = LLONG_MAX;

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

namespace A{
    void in(vector<int> &arr){
        for(auto &v:arr){
            cin>>v;
        }
    }
    vector<int> sorted(vector<int> arr){
        vector<int> sortme=arr;
        sort(all(sortme));
        return sortme;
    }
    string reversed(string s){
        return string(s.rbegin(),s.rend());
    }
};
using namespace A;

void kermit(){
    string s;
    cin>>s;
    string t="";
    int n=sz(s);
    for(int i=0;i<n;i++){
        // cout<<s.substr(i,n)<<endl;
        if( s.substr(i,n)==reversed(s.substr(i,n)) ){
            break;
        }
        t+=s[i];
    }
    reverse(all(t));
    cout<<s+t<<endl;
}

signed main(){
    // freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
    cin.tie(0)->sync_with_stdio(0);
    int T = 1;
    // cin>>T;
    while(T--){
        kermit();
    }
    return 0;
}
0