結果

問題 No.24 数当てゲーム
ユーザー N/AN/A
提出日時 2018-06-25 01:44:23
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 671 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 28,076 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-13 13:50:12
合計ジャッジ時間 1,026 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int i, j, tep, freq, ans, oldi = -256;
	int sugg[4];
	char resp[4];
	int opt[10] = { 0 };


		
	scanf("%d", &freq);

	for (i = 0; i < freq; i++) {
		scanf("%d %d %d %d %s", &sugg[0], &sugg[1], &sugg[2], &sugg[3], &resp);

		if (resp[0] == 'Y') {
			for (j = 0; j < 4; j++) {
				tep = sugg[j];
				opt[tep]++;
			}
		}
		else if (resp[0] == 'N') {
			for (j = 0; j < 4; j++) {
				tep = sugg[j];
				opt[tep]--;
			}
		}
	}



	for (i = 0; i < 10; i++) {
		if (oldi < opt[i]) {
			ans = i;
			oldi = opt[i];
		}
	}

	printf("%d\n", ans);

	return 0;
}



0