結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-11-13 21:33:29 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 824 bytes |
コンパイル時間 | 1,950 ms |
コンパイル使用メモリ | 74,876 KB |
実行使用メモリ | 42,084 KB |
最終ジャッジ日時 | 2024-11-25 21:58:53 |
合計ジャッジ時間 | 6,763 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 28 WA * 1 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int h = (N+1)/2; String [] E = {"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"}; String [] A = new String [N]; int [] B = new int [12]; int max = 0; for(int i=0; i<N; i++){ A[i] = sc.next(); for(int j=0; j<12; j++){ if( E[j].equals(A[i]) ){ B[j]++; max = Math.max(max, B[j]); break; } if(max>h){ System.out.println("NO"); return; } } } System.out.println("YES"); } }