結果

問題 No.349 干支の置き物
ユーザー Maeda
提出日時 2025-03-25 14:35:09
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 25,600 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-25 14:35:13
合計ジャッジ時間 2,073 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:52: warning: excess elements in array initializer
    7 |         int etoList[12] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
      |                                                    ^
main.c:7:52: note: (near initialization for ‘etoList’)
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%s",str);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

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

void main(void){
    const char eto[12][10] = {"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"};
	int etoList[12] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    char str[100] = "a";
    int n = 0;
	scanf("%d",&n);
	for(int i = 0 ; i < n ;i++){
		scanf("%s",str);
        for(int j = 0 ; j < 12 ; j++){
            if(strcmp(eto[j],str) == 0){
                etoList[j]++;
                break;
            }
        }
	}
    bool orderFlg = true;
    for(int i = 0 ; i < 12 ;i++){
        if(n/2+1 < etoList[i]){
            orderFlg = false;
        }
    }
    if(orderFlg){
        printf("YES");
    }else{
        printf("NO");
    }

}
0