結果
| 問題 |
No.349 干支の置き物
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-11-04 12:27:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 2,000 ms |
| コード長 | 668 bytes |
| コンパイル時間 | 2,208 ms |
| コンパイル使用メモリ | 76,560 KB |
| 実行使用メモリ | 56,060 KB |
| 最終ジャッジ日時 | 2024-07-22 09:55:53 |
| 合計ジャッジ時間 | 7,917 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
String[] etoes = new String[]{"ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"};
HashMap<String, Integer> idxes = new HashMap<>();
for (int i = 0; i < etoes.length; i++) {
idxes.put(etoes[i], i);
}
int[] counts = new int[etoes.length];
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
counts[idxes.get(sc.next())]++;
}
Arrays.sort(counts);
if (counts[counts.length - 1] > (n + 1) / 2) {
System.out.println("NO");
} else {
System.out.println("YES");
}
}
}
tenten