結果

問題 No.349 干支の置き物
ユーザー Mcpu3
提出日時 2018-09-02 10:30:45
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 17:25:34
合計ジャッジ時間 1,269 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int q(const void *a,const void *b)
{
    return *(int*)b-*(int*)a;
}

int main(void)
{
    char a[8];
    int n,t[12]={0},i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",a);
        if(strcmp(a,"ne")==0)t[0]++;
        else if(strcmp(a,"ushi")==0)t[1]++;
        else if(strcmp(a,"tora")==0)t[2]++;
        else if(strcmp(a,"u")==0)t[3]++;
        else if(strcmp(a,"tatsu")==0)t[4]++;
        else if(strcmp(a,"mi")==0)t[5]++;
        else if(strcmp(a,"uma")==0)t[6]++;
        else if(strcmp(a,"hitsuji")==0)t[7]++;
        else if(strcmp(a,"saru")==0)t[8]++;
        else if(strcmp(a,"tori")==0)t[9]++;
        else if(strcmp(a,"inu")==0)t[10]++;
        else t[11]++;
    }
    qsort(t,12,sizeof(int),q);
    puts(t[0]>(n+1)/2?"NO":"YES");
    return 0;
}
0