結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  AoiroFukurou | 
| 提出日時 | 2016-05-23 12:06:16 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 137 ms / 5,000 ms | 
| コード長 | 838 bytes | 
| コンパイル時間 | 3,529 ms | 
| コンパイル使用メモリ | 77,444 KB | 
| 実行使用メモリ | 41,460 KB | 
| 最終ジャッジ日時 | 2024-10-07 00:54:23 | 
| 合計ジャッジ時間 | 5,600 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
package yukicoder;
import java.util.Scanner;
public class No24 {
	public static void main(String[] args) {
		int[] num = new int[10];
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		for(int i = 0; i < N; i++){
			int[] h = new int[4];
			String s = null;
			h[0] = sc.nextInt();
			h[1] = sc.nextInt();
			h[2] = sc.nextInt();
			h[3] = sc.nextInt();
			s = sc.nextLine();
			if(s.equals(" YES")){
				W1(num, h);
			}else if(s.equals(" NO")){
				W2(num, h);
			}
		}
		int ans = 0;
		for(int i = 1; i < 10; i++){
			if(num[ans] < num[i]){
				ans = i;
			}
		}
		System.out.println(ans);
	}
	public static int[] W1(int[] num, int[] h){
		for(int i = 0; i < 4; i++){
			num[h[i]]++;
		}
		return num;
	}
	public static int[] W2(int[] num, int[] h){
		for(int i = 0; i < 4; i++){
			num[h[i]]--;
		}
		return num;
	}
}
            
            
            
        