結果
問題 |
No.349 干支の置き物
|
ユーザー |
![]() |
提出日時 | 2016-05-19 00:32:30 |
言語 | Perl (5.40.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 53 ms |
コンパイル使用メモリ | 6,692 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-06 05:45:23 |
合計ジャッジ時間 | 927 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 5 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict; my $N = <STDIN>; my @list; my $str; for (my $i = 0; $i < $N; $i++) { $str = <STDIN>; push(@list, $str); } @list = sort {$a <=> $b} @list; my $cnt = 0; my $cnt_max = 0; my $res = ""; foreach my $i(@list) { if($i ne $res) { $cnt = 0; } $cnt++; $res = $i; if($cnt > $cnt_max) { $cnt_max = $cnt; } } if($cnt_max > int(@list / 2) + 1) { print "NO\n"; } else { print "YES\n"; }