結果

問題 No.349 干支の置き物
ユーザー focusfocus
提出日時 2018-02-17 17:38:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 68,940 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-06 17:49:49
合計ジャッジ時間 1,547 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,384 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 1 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:10:18: 警告: ‘N’ is used uninitialized [-Wuninitialized]
   10 |     for(int i=0;i<N;i++){
      |                 ~^~
main.cpp:9:9: 備考: ‘N’ はここで定義されています
    9 |     int N,a[12];
      |         ^
main.cpp:27:15: 警告: ‘a’ is used uninitialized [-Wuninitialized]
   27 |         if(a[i]>(N+1)/2){
      |            ~~~^
main.cpp:9:11: 備考: ‘a’ はここで宣言されています
    9 |     int N,a[12];
      |           ^

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<map>
#include<cstring>
using namespace std;

int main(){
    int N,a[12];
    for(int i=0;i<N;i++){
        char s[100];
        cin >> s;
		if(strcmp(s,"ne")==0)a[0]++;
		else if(strcmp(s,"ushi")==0)a[1]++;
		else if(strcmp(s,"tora")==0)a[2]++;
		else if(strcmp(s,"u")==0)a[3]++;
		else if(strcmp(s,"tatsu")==0)a[4]++;
		else if(strcmp(s,"mi")==0)a[5]++;
		else if(strcmp(s,"uma")==0)a[6]++;
		else if(strcmp(s,"hitsuji")==0)a[7]++;
		else if(strcmp(s,"saru")==0)a[8]++;
		else if(strcmp(s,"tori")==0)a[9]++;
		else if(strcmp(s,"inu")==0)a[10]++;
		else if(strcmp(s,"i")==0)a[11]++;
    }
    for(int i=0;i<12;i++){
        if(a[i]>(N+1)/2){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES"; 
    return 0;
}
0