結果
問題 | No.349 干支の置き物 |
ユーザー |
|
提出日時 | 2017-04-02 21:48:17 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 686 bytes |
コンパイル時間 | 3,781 ms |
コンパイル使用メモリ | 75,828 KB |
実行使用メモリ | 54,796 KB |
最終ジャッジ日時 | 2024-07-08 00:16:34 |
合計ジャッジ時間 | 8,443 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 7 |
ソースコード
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Eto { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); int N = s.nextInt(); int[] eto = new int[12]; ArrayList<String> list = new ArrayList<>(); for(int i = 0;i < N;i++){ String str = s.next(); if(list.contains(str)){ eto[list.indexOf(str)]++; }else{ //System.out.println(list); list.add(str); eto[list.indexOf(str)]++; } } s.close(); Arrays.sort(eto); if(N-eto[11] >= eto[11] + 1){ System.out.println("YES"); }else{ System.out.println("NO"); } } }