結果

問題 No.227 簡単ポーカー
ユーザー iwotiwot
提出日時 2019-04-26 22:35:41
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 147,348 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-16 15:24:08
合計ジャッジ時間 1,990 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `i`
 --> Main.rs:9:9
  |
9 |     for i in 0..13 {
  |         ^ help: if this is intentional, prefix it with an underscore: `_i`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    let mut input = String::new();
    let _ = std::io::stdin().read_line(&mut input);
    let mut input: Vec<usize> = input.trim().split_whitespace().map(|n| n.parse().unwrap()).collect();

    input.sort();

    let mut checker: Vec<usize> = Vec::with_capacity(13);
    for i in 0..13 {
        checker.push(0)
    }
    for i in input {
        checker[i-1] += 1;
    }
    checker.sort();
    checker.reverse();

    let result = match checker[0] {
        3 if checker[1] == 2 => "FULL HOUSE",
        3 => "THREE CARD",
        2 if checker[1] == 2 => "TWO PAIR",
        2 => "ONE PAIR",
        _ => "NO HAND",
    };
    println!("{}", result);
}
0