結果

問題 No.2235 Line Up Colored Balls
ユーザー Teddy
提出日時 2023-03-04 10:01:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 195,040 KB
最終ジャッジ日時 2025-02-11 05:06:49
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 2 WA * 53
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void solve(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        bool f = true;
        int l = i, r = s.size()-1; 
        while(l < r){
            if(s[l] != s[r]){
                f = false;
                break;
            }
            l++;
            r--;
        }
        if(f){
            string t = s.substr(0, i);
            reverse(t.begin(), t.end());
            cout << s << t << "\n";
            return;
        }
    }
    string t = s;
    reverse(t.begin(), t.end());
    cout << s << t << "\n";
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // int t;
    // cin >> t;
    // while(t--){
    //    solve();     
    // }
    solve();
    return 0;
}
0