結果
問題 | No.349 干支の置き物 |
ユーザー | yuya178 |
提出日時 | 2017-06-20 06:24:13 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 2,342 bytes |
コンパイル時間 | 2,072 ms |
コンパイル使用メモリ | 77,952 KB |
実行使用メモリ | 37,324 KB |
最終ジャッジ日時 | 2024-10-02 08:02:46 |
合計ジャッジ時間 | 4,860 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
37,068 KB |
testcase_01 | AC | 54 ms
37,104 KB |
testcase_02 | AC | 54 ms
37,092 KB |
testcase_03 | AC | 55 ms
37,076 KB |
testcase_04 | AC | 55 ms
37,324 KB |
testcase_05 | AC | 53 ms
37,276 KB |
testcase_06 | AC | 54 ms
37,184 KB |
testcase_07 | AC | 53 ms
37,036 KB |
testcase_08 | AC | 55 ms
37,088 KB |
testcase_09 | AC | 54 ms
37,092 KB |
testcase_10 | AC | 53 ms
37,064 KB |
testcase_11 | AC | 55 ms
37,092 KB |
testcase_12 | AC | 55 ms
36,788 KB |
testcase_13 | AC | 54 ms
37,288 KB |
testcase_14 | AC | 54 ms
37,028 KB |
testcase_15 | AC | 55 ms
37,180 KB |
testcase_16 | AC | 56 ms
37,216 KB |
testcase_17 | AC | 54 ms
37,204 KB |
testcase_18 | AC | 54 ms
37,312 KB |
testcase_19 | AC | 53 ms
37,292 KB |
testcase_20 | AC | 57 ms
37,252 KB |
testcase_21 | AC | 56 ms
37,292 KB |
testcase_22 | AC | 55 ms
37,308 KB |
testcase_23 | AC | 54 ms
36,804 KB |
testcase_24 | AC | 55 ms
37,268 KB |
testcase_25 | AC | 54 ms
37,256 KB |
testcase_26 | AC | 55 ms
37,084 KB |
testcase_27 | AC | 54 ms
37,288 KB |
testcase_28 | AC | 54 ms
37,088 KB |
testcase_29 | AC | 54 ms
37,188 KB |
testcase_30 | AC | 55 ms
37,180 KB |
testcase_31 | AC | 54 ms
37,248 KB |
ソースコード
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { int N = in.nextInt(); String eto[] ={"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"}; int count[] = new int[12]; for(int i=0; i<N; i++){ String s = in.next(); for(int j=0; j<12; j++){ if(s.equals(eto[j])){ count[j]++; } } } for(int i=0; i<12; i++){ if(count[i]>(N+1)/2){ out.println("NO"); return; } } out.println("YES"); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }