結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-02-18 21:30:07 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 723 bytes | 
| コンパイル時間 | 2,078 ms | 
| コンパイル使用メモリ | 194,196 KB | 
| 最終ジャッジ日時 | 2025-01-06 21:14:50 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int isNum(bool _num[10]){
	int ans=0;
	for(int i=0;i<10;i++){
		if(_num[i]==true){
			ans = i;
			break;
		}
	}
	return ans;
}
int main()
{
	int n;
	cin>>n;
	bool num[10];
	for(int i=0;i<10;i++)num[i]=true;
	int candidate[4];
	string str;
	for(int i=0;i<n;i++){
		for(int i=0;i<4;i++)cin>>candidate[i];
		cin>>str;
		if(str=="NO"){
			for(int i=0;i<4;i++)num[candidate[i]]=false;
		}
		else if(str=="YES"){
			for(int i=0;i<10;i++){
				if(candidate[0]==i||candidate[1]==i||candidate[2]==i||candidate[3]==i){
				}else{
					num[i]=false;
				}
			}
		}
	}
	//for(int i=0;i<10;i++){
	//	if(num[i]==true)cout<<i<<" ";
	//}
	//cout<<endl;
	cout<<isNum(num)<<endl;
	return 0;
}
            
            
            
        