結果
| 問題 | No.2234 palindromer |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-01 01:23:17 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 505 bytes |
| 記録 | |
| コンパイル時間 | 2,337 ms |
| コンパイル使用メモリ | 188,544 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-13 21:02:48 |
| 合計ジャッジ時間 | 3,519 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 4 WA * 9 |
ソースコード
use proconio::input;
fn main() {
input! {
a: String,
}
// 回文確認
pub fn is_palindrome(s: &str) -> bool {
s.chars().rev().collect::<String>() == s
}
// もし回文ならば、aをそのまま出力する。そうでなければ、aにaの末尾を削除して追加する。
if is_palindrome(&a) {
println!("{}", a);
} else {
let mut a = a;
a.pop();
println!("{}{}", a, a.chars().rev().collect::<String>());
}
}