結果

問題 No.24 数当てゲーム
ユーザー mits58
提出日時 2016-07-02 15:01:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 76,584 KB
実行使用メモリ 41,448 KB
最終ジャッジ日時 2024-10-12 00:49:22
合計ジャッジ時間 4,369 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int y=0;
			int[] num=new int[10];
			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("NO")){
					num[a]=-1; num[b]=-1; num[c]=-1; num[d]=-1;
				}
				else{
					y++;
					if(num[a]!=-1) num[a]++;
					if(num[b]!=-1) num[b]++;
					if(num[c]!=-1) num[c]++;
					if(num[d]!=-1) num[d]++;
				}
			}
			for(int i=0;i<10;i++){
				if(num[i]==y){
					System.out.println(i);
					break;
				}
			}
		}
	}
}
0