結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2016-02-19 09:06:25 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 134 ms / 5,000 ms |
コード長 | 838 bytes |
コンパイル時間 | 2,810 ms |
コンパイル使用メモリ | 78,184 KB |
実行使用メモリ | 54,224 KB |
最終ジャッジ日時 | 2024-09-22 12:13:26 |
合計ジャッジ時間 | 4,235 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.Scanner;public class Main {public static void main(String[] args) {try (Scanner scan = new Scanner(System.in)) {int N = scan.nextInt();boolean isNo[] = new boolean[10];int count[] = new int [10];for(int i=0; i<N; i++) {int v1 = scan.nextInt();int v2 = scan.nextInt();int v3 = scan.nextInt();int v4 = scan.nextInt();String s = scan.next();if(s.equals("YES")) {count[v1]++;count[v2]++;count[v3]++;count[v4]++;} else if(s.equals("NO")) {isNo[v1] = isNo[v2] = isNo[v3] = isNo[v4] = true;}}int max = 0;for(int i=0; i<10; i++) {max = Math.max(max, count[i]);}for(int i=0; i<10; i++) {if(count[i] == max && isNo[i] == false) {System.out.println(i);break;}}}}}