結果

問題 No.24 数当てゲーム
ユーザー C_kumoC_kumo
提出日時 2019-01-21 00:36:13
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 1,399 ms
コンパイル使用メモリ 29,004 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 07:19:12
合計ジャッジ時間 2,353 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

#define YES 'Y'
#define NO 'N'

int main(void)
{
	char n,i,a[9],b[9],c[9],d[9],r[9][4],rr[9],arr[10]={},max,maxN;
	scanf("%hhd",&n);
	for (i=0;i<n;i++) {
		scanf("%hhd %hhd %hhd %hhd %s",&a[i],&b[i],&c[i],&d[i],r[i]);
		rr[i] = (r[i][0]==YES)?1:0;
	}
	
	for (i=0;i<n;i++) {
		if (rr[i]==0) {
			arr[a[i]] = -99;
			arr[b[i]] = -99;
			arr[c[i]] = -99;
			arr[d[i]] = -99;
		} else {
			arr[a[i]]++;
			arr[b[i]]++;
			arr[c[i]]++;
			arr[d[i]]++;
		}
	}
	max = -100;
	maxN = -1;
	for (i=0;i<10;i++) {
		if (max < arr[i]) {
			max = arr[i];
			maxN = i;
		}
	}

	printf("%hhd\n",maxN);

	return 0;
}
0