結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2016-01-14 02:31:36 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 7,076 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 18:59:56 |
合計ジャッジ時間 | 752 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
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;