結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  kriii | 
| 提出日時 | 2018-03-04 03:47:27 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 480 bytes | 
| コンパイル時間 | 116 ms | 
| コンパイル使用メモリ | 23,296 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-05 21:08:48 | 
| 合計ジャッジ時間 | 662 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf ("%d",&N);
      |         ~~~~~~^~~~~~~~~
main.cpp:8:45: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 for (int k=0;k<4;k++) scanf ("%d",&X[i][k]);
      |                                       ~~~~~~^~~~~~~~~~~~~~~
main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf ("%s",Y[i]);
      |                 ~~~~~~^~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main()
{
	int N,X[9][4]; char Y[9][5];
	scanf ("%d",&N);
	for (int i=0;i<N;i++){
		for (int k=0;k<4;k++) scanf ("%d",&X[i][k]);
		scanf ("%s",Y[i]);
	}
	for (int a=0;a<=9;a++){
		bool g = 1;
		for (int i=0;i<N;i++){
			if (Y[i][0] == 'Y'){
				bool f = 0;
				for (int k=0;k<4;k++) if (X[i][k] == a) f = 1;
				if (!f) g = 0;
			}
			else{
				for (int k=0;k<4;k++) if (X[i][k] == a) g = 0;
			}
		}
		if (g) printf ("%d",a);
	}
	puts("");
	return 0;
}
            
            
            
        