結果
問題 | No.24 数当てゲーム |
ユーザー |
|
提出日時 | 2017-10-12 00:25:46 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 55 ms / 5,000 ms |
コード長 | 1,136 bytes |
コンパイル時間 | 3,411 ms |
コンパイル使用メモリ | 77,972 KB |
実行使用メモリ | 48,172 KB |
最終ジャッジ日時 | 2024-11-17 09:54:42 |
合計ジャッジ時間 | 4,342 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class No24{public static void main(String[] args) {try{BufferedReader br = new BufferedReader(new InputStreamReader(System.in));int turn = Integer.parseInt(br.readLine());kazuate(br, turn);}catch(IOException e){e.getStackTrace();}catch(NumberFormatException e){e.getStackTrace();}}public static void kazuate(BufferedReader br, int n) throws IOException, NumberFormatException{int[] jiroThought = new int[10];int[] taroSuggest = new int[4];for(int i=0; i < n; i++){String[] str = br.readLine().split(" ");for(int j=0; j < 4; j++)taroSuggest[j] = Integer.parseInt(str[j]);for(int k=0; k < 4; k++){if(str[4].equals("YES")) jiroThought[taroSuggest[k]]++;else if (str[4].equals("NO")) jiroThought[taroSuggest[k]]--;}}System.out.println(getIndex(jiroThought));}public static int getIndex(int[] a){int ans = 0;int max = 0;for(int i=0; i < a.length; i++){if(max <= a[i]){max = a[i];ans = i;}}return ans;}}