結果

問題 No.24 数当てゲーム
ユーザー harahara164harahara164
提出日時 2018-02-09 16:31:40
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 684 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 30,336 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 16:48:21
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main() {
	
	int turn, i, j, t, P[7][6];  //入力は配列P[何回目の予想か][何番目の数字か]で受け取る 
	int A[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
	char str[4];
	
	scanf("%d", &turn);
	
	for (i = 1; i <= turn; i++) {
		for (j = 1; j <= 4; j++) {
			scanf("%d", &P[i][j]);
		}
		scanf("%s", str);
		
		if (strcmp(str, "YES") == 0) {
			for (j = 0; j <= 9; j++) {
				if (j != P[i][1] && j != P[i][2] && j != P[i][3] && j != P[i][4]) {
					A[j] *= 0;
				}
			}
		} else {
			for (t = 1; t <= 4; t++) {
				A[ P[i][t] ] *= 0;
			}
		}
		
	}
	
	for (i = 0; i <= 9; i++) {
		if ( A[i] == 1){
			printf( "%d\n", i);
		}
	}
}
0