結果
| 問題 | No.1934 Four Fruits |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 20:43:53 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 640 bytes |
| 記録 | |
| コンパイル時間 | 17,437 ms |
| コンパイル使用メモリ | 404,796 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-21 17:48:02 |
| 合計ジャッジ時間 | 18,143 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
fn main() {
let mut abc = String::new();
std::io::stdin().read_line(&mut abc).ok();
let abc: Vec<usize> = abc.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
let mut cnts = vec![0usize; 4];
for &v in abc.iter() {
cnts[v] += 1;
}
if cnts.contains(&3) {
println!("{}", cnts.iter().enumerate().filter(|&(_, &v)| v == 3).nth(0).unwrap().0);
} else if cnts.contains(&2) {
println!("{}", cnts.iter().enumerate().filter(|&(_, &v)| v == 1).nth(0).unwrap().0);
} else {
println!("{}", cnts.iter().enumerate().filter(|&(_, &v)| v == 0).nth(0).unwrap().0);
}
}