結果
| 問題 |
No.2234 palindromer
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-01 01:23:17 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 505 bytes |
| コンパイル時間 | 15,328 ms |
| コンパイル使用メモリ | 379,732 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 15:07:38 |
| 合計ジャッジ時間 | 15,499 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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>());
}
}