結果
問題 |
No.8116 TCP ソート
|
ユーザー |
|
提出日時 | 2025-06-12 16:17:34 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 17,967 ms |
コンパイル使用メモリ | 399,220 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-06-12 16:18:34 |
合計ジャッジ時間 | 15,788 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
warning: value assigned to `c` is never read --> src/main.rs:9:13 | 9 | let mut c = 0; | ^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` on by default
ソースコード
use proconio::input; fn main() { input! { s: String, } let mut ans = String::new(); let mut c = 0; c = s.chars().filter(|&c| c == 'C').count() as i32; if c == 0 { c = s.chars().filter(|&c| c == 'P').count() as i32; for _ in 0..c { ans += "P"; } c = s.chars().filter(|&c| c == 'T').count() as i32; for _ in 0..c { ans += "T"; } } else { c = s.chars().filter(|&c| c == 'T').count() as i32; for _ in 0..c { ans += "T"; } c = s.chars().filter(|&c| c == 'C').count() as i32; for _ in 0..c { ans += "C"; } c = s.chars().filter(|&c| c == 'P').count() as i32; for _ in 0..c { ans += "P"; } } println!("{}", ans); }