結果

問題 No.24 数当てゲーム
ユーザー togaerrortogaerror
提出日時 2016-01-14 02:31:36
言語 Perl
(5.38.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 472 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 5,924 KB
実行使用メモリ 5,936 KB
最終ジャッジ日時 2023-10-19 23:02:07
合計ジャッジ時間 852 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,936 KB
testcase_01 AC 7 ms
5,936 KB
testcase_02 AC 7 ms
5,932 KB
testcase_03 AC 7 ms
5,936 KB
testcase_04 AC 7 ms
5,936 KB
testcase_05 AC 6 ms
5,936 KB
testcase_06 AC 6 ms
5,936 KB
testcase_07 AC 7 ms
5,936 KB
testcase_08 AC 7 ms
5,936 KB
testcase_09 AC 6 ms
5,932 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;

my $n = <>;
my @ans = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
for(my $i = 0; $i < $n; $i++) {
	my @array = split / /, <>;
	chomp $array[4];

	if($array[4] eq 'YES') {
		for(my $j = 0; $j < 4; $j++) {
			$ans[$array[$j]]++;
		}
	} else {
		for(my $j = 0; $j < 4; $j++) {
			$ans[$array[$j]]--;
		}
	}
}
my $res = 0;
my $count = $ans[0];
for(my $i = 1; $i < 10; $i++) {
	if($count < $ans[$i]) {
		$count = $ans[$i];
		$res = $i;
	}
}
print "$res\n";
exit;
0