結果

問題 No.2234 palindromer
コンテスト
ユーザー NixOS_and_Gentoo
提出日時 2023-05-01 01:41:21
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 783µs
コード長 443 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,307 ms
コンパイル使用メモリ 186,692 KB
実行使用メモリ 9,836 KB
最終ジャッジ日時 2026-09-26 18:59:03
合計ジャッジ時間 4,414 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut line = String::new();
    stdin.lock().read_line(&mut line).unwrap();
    let a = line.trim();

    let n = a.len();
    for i in 0..=n {
        let b = &a[..i];
        let x = format!("{}{}", a, b.chars().rev().collect::<String>());
        if x == x.chars().rev().collect::<String>() {
            println!("{}", x);
            return;
        }
    }
}
0