結果

問題 No.349 干支の置き物
ユーザー Himatsubushin
提出日時 2020-12-26 14:55:00
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 17:51:56
合計ジャッジ時間 2,049 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(void)
{
  int count[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  char *string[] = {"ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"};
  int i, j, n, max = 0;
  char data[10];

  scanf("%d", &n);
  
  for (i = 0; i < n; i++)
  {
    scanf("%s", data);
    for (j = 0; j < 12; j++)
      if (strcmp(string[j], data) == 0)
      {
        count[j]++;
      }
  }
  
  for (j = 0; j < 12; j++)
  {
    if (max < count[j])
      max = count[j];
  }
  
  if (max * 2 <= n + 1)
    printf("YES");
  else
    printf("NO");
  
  return EXIT_SUCCESS;
}
0