結果
問題 | No.267 トランプソート |
ユーザー | tonyu0 |
提出日時 | 2020-04-29 02:10:27 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 995 bytes |
コンパイル時間 | 14,517 ms |
コンパイル使用メモリ | 378,684 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 10:22:00 |
合計ジャッジ時間 | 14,422 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let a: Vec<String> = (0..n).map(|_| itr.next().unwrap().to_string()).collect(); let mut map = std::collections::HashMap::new(); for i in 0..n { let p = map.entry(a[i].clone()).or_insert(false); *p = true; } let mut cnt = 0; for a in ['D', 'C', 'H', 'S'].to_vec() { for b in [ 'A', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', ] .to_vec() { let p = map.entry(format!("{}{}", a, b)).or_insert(false); if *p { print!("{}{}", a, b); cnt += 1; if cnt == n { println!(""); } else { print!(" "); } } } } }