結果

問題 No.227 簡単ポーカー
ユーザー 3846masa3846masa
提出日時 2015-06-21 02:14:05
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 6,132 KB
実行使用メモリ 6,456 KB
最終ジャッジ日時 2023-09-21 22:16:32
合計ジャッジ時間 1,162 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use Data::Dumper;

chomp($_ = <STDIN>);
@_ = split(' ', $_);

my %hash = ();
foreach (@_) {
    $hash{$_}++;
}

print Dumper(\%hash);

my $result = 0;
while (my ($key, $val) = each(%hash)) {
    if ($result == 0) {
        $result = 1 if ($val == 2);
        $result = 3 if ($val == 3);
    } elsif ($result == 1) {
        $result = 2 if ($val == 2);
        $result = 9 if ($val == 3);
    } elsif ($result == 3) {
        $result = 9 if ($val == 2);
    }
}

print "ONE PAIR" if ($result == 1);
print "TWO PAIR" if ($result == 2);
print "THREE CARD" if ($result == 3);
print "FULL HOUSE" if ($result == 9);
print "NO HAND" if ($result == 0);

print "\n";
0