結果

問題 No.24 数当てゲーム
ユーザー A63295A63295
提出日時 2016-01-03 15:21:48
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 539 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 22,048 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 14:37:13
合計ジャッジ時間 1,036 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 0 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 | scanf ("%d", &N);
      | ^~~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf ("%d%d%d%d%s", &A[i][0], &A[i][1], &A[i][2], &A[i][3], R[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main(void){
int N;
int A[6][4];
char R[6][4];
int i, j, max = 0, hanntei[10] = {};
scanf ("%d", &N);
for ( i = 0; i < N; i++)
	scanf ("%d%d%d%d%s", &A[i][0], &A[i][1], &A[i][2], &A[i][3], R[i]);

for ( i = 0; i < N; i++){
	if ( strcmp ( R[i] , "YES") == 0){
		for ( j = 0; j < 4; j++)
			hanntei[A[i][j]] += 1;
	}else{
		for ( j = 0; j < 4; j++)
			hanntei[A[i][j]] -= 1;		
	}
}
for ( i = 0; i < 10; i++){
	if ( max <= hanntei[i]){
		max = hanntei[i];
		j = i;
	}	
}
	printf ("%d", j);
	return 0;
}
0