結果

問題 No.24 数当てゲーム
ユーザー teioteio
提出日時 2020-07-25 07:30:05
言語 Perl
(5.38.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-09-08 17:36:43
合計ジャッジ時間 743 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,536 KB
testcase_01 AC 3 ms
4,660 KB
testcase_02 AC 3 ms
4,600 KB
testcase_03 AC 3 ms
4,656 KB
testcase_04 AC 3 ms
4,716 KB
testcase_05 AC 3 ms
4,668 KB
testcase_06 AC 2 ms
4,536 KB
testcase_07 AC 2 ms
4,776 KB
testcase_08 AC 2 ms
4,516 KB
testcase_09 AC 3 ms
4,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

# use strict;
# use warnings;

my %d;
$d{$_} = 0 foreach 0 .. 9;
<>;
my $c = 0;
while (<>) {
    chomp;
    my @x = split(/\s/);
    my @ds = @x[0 .. ($#x - 1)];
    my $b = $x[-1];
    if ($b eq 'YES') {
        $c++;
        foreach (@ds) {
            $d{$_}++ if exists($d{$_});
        }
        foreach (keys(%d)) {
            delete $d{$_} if $d{$_} < $c;
        }
    } else {
        delete $d{$_} foreach @ds;
    }
    last if scalar(keys(%d)) == 1;
}
print((keys(%d))[0], "\n");
0