結果

問題 No.24 数当てゲーム
ユーザー umashikaumashika
提出日時 2016-02-27 00:24:29
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 568 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 21,908 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 18:02:23
合計ジャッジ時間 635 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 1 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 0 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:13:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |   scanf("%d",&N);
      |   ^~~~~~~~~~~~~~
main.c:15:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     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()
{
  int  N;
  int  a[6][4];
  char r[6][4];
  int  i,j;
  int  max = 0;
  int  flag[10]={0};

  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++){
        flag[a[i][j]] += 1;
      }
    }else{
      for(j=0;j<4;j++){
        flag[a[i][j]] -= 1;
      }
    }
  }
  for(i=0;i<10;i++){
    if(max<=flag[i]){
      max = flag[i];
      j = i;
    }
  }
  printf("%d\n",j);
  return 0;
}
0