結果

問題 No.24 数当てゲーム
ユーザー mosmos_21mosmos_21
提出日時 2016-02-14 16:23:05
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 21,280 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 05:14:51
合計ジャッジ時間 1,146 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:14:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                         scanf("%d", &in[j]);
      |                         ^~~~~~~~~~~~~~~~~~~
main.c:15:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%s", yn);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	int n, num[10] = {0}, max = 0;
	int i, j;

	int in[4];
	char yn[8];

	scanf("%d", &n);

	for(i = 0; i < n; i++){
		for(j = 0; j < 4; j++)
			scanf("%d", &in[j]);
		scanf("%s", yn);

		for(j = 0; j < 4; j++)
			num[in[j]] += yn[0] == 'Y' ? 1 : -1;

	}

	for(i = 1; i < 10; i++){
		if(num[max] < num[i])
			max = i;
	}

	printf("%d\n", max);
	return 0;
}
0