結果
問題 |
No.24 数当てゲーム
|
ユーザー |
|
提出日時 | 2018-04-11 06:47:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 136 ms / 5,000 ms |
コード長 | 1,138 bytes |
コンパイル時間 | 3,995 ms |
コンパイル使用メモリ | 79,832 KB |
実行使用メモリ | 54,228 KB |
最終ジャッジ日時 | 2024-06-26 21:11:13 |
合計ジャッジ時間 | 5,460 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.ArrayList; import java.util.Scanner; public class No24 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayList<Integer> noList = new ArrayList<Integer>(); ArrayList<Integer> yesList = new ArrayList<Integer>(); for (int i = 0; i < N; i++) { int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); String R = sc.next(); if (R.equals("YES")) { yesList.add(A); yesList.add(B); yesList.add(C); yesList.add(D); } else { noList.add(A); noList.add(B); noList.add(C); noList.add(D); } } if (yesList.size() == 0) { for (int i = 0; i < 10; i++) { if (!noList.contains(i)) { System.out.println(i); } } } else { int mostNo = 0; int mostCount = 0; for (int i : yesList) { if (noList.contains(i)) { continue; } int count = 0; for (int j : yesList) { if (i == j) { count++; } } if (mostCount < count) { mostNo = i; mostCount = count; } } System.out.println(mostNo); } } }