結果
問題 | No.24 数当てゲーム |
ユーザー |
|
提出日時 | 2016-07-18 17:24:08 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 1,055 bytes |
コンパイル時間 | 3,496 ms |
コンパイル使用メモリ | 78,192 KB |
実行使用メモリ | 50,240 KB |
最終ジャッジ日時 | 2024-10-15 16:59:07 |
合計ジャッジ時間 | 4,571 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class No0024 {public static void main(String[] args) {try (BufferedReader br =new BufferedReader(new InputStreamReader(System.in))) {int cntTurn = Integer.parseInt(br.readLine());String[] str;int[] num = new int[10];for(int i =0; i < cntTurn ; i++){str = br.readLine().trim().split(" ");if(str[str.length - 1].endsWith("NO")){for(int j = 0; j < str.length - 1; j++){num[Integer.parseInt(str[j])] = -1;//リセット}}else if(str[str.length - 1].endsWith("YES")){for(int j = 0; j < str.length - 1; j++){num[Integer.parseInt(str[j])] += 1;}}}int max = 0;for(int n:num){max = Math.max(max, n);}for(int i = 0; i < num.length ; i++){if(num[i] == max){System.out.println(i);}}} catch (IOException e) {e.printStackTrace();}}}