結果
問題 | No.349 干支の置き物 |
ユーザー |
|
提出日時 | 2017-04-27 12:23:47 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 286 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-09-13 14:47:26 |
合計ジャッジ時間 | 3,895 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 29 |
コンパイルメッセージ
Syntax OK
ソースコード
n=gets.to_i #number of animals a=$stdin.read.split(?\n).map().sort #array of animals a.each {|str| m=(m>a.count(str)? m:a.count(str)) } flag = 0 if n%2==0 if m<=n/2 flag=1 end else if m<=(n+1)/2 flag=1 end end if flag==1 puts "YES" elsif flag==0 puts"NO" end