結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-10-28 16:56:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 144 ms / 2,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 2,050 ms |
コンパイル使用メモリ | 77,852 KB |
実行使用メモリ | 41,972 KB |
最終ジャッジ日時 | 2024-11-24 05:12:05 |
合計ジャッジ時間 | 7,093 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
import java.util.*; class A { static Scanner s = new Scanner(System.in); static enum ETO{ ne, ushi, tora, u, tatsu, mi, uma, hitsuji, saru, tori, inu, i, ; int amount=0; static ETO match(String s) { boolean b = false; for(ETO eto:ETO.values()) { if(s.matches(eto.name())) { eto.amount++; return eto; } } return null; } @Override public String toString() { return this.name()+":"+this.amount; } } public static void main(String[] args) { int in = s.nextInt(); while(s.hasNext()) { ETO.match(s.next()); } int max = 0; for(ETO e:ETO.values()) { max = Math.max(max, e.amount); } if(max>in-max+1) { System.out.println("NO"); }else { System.out.println("YES"); } } }