結果

問題 No.24 数当てゲーム
ユーザー ElkElk
提出日時 2018-05-28 23:28:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 842 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 26,992 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 20:16:28
合計ジャッジ時間 732 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N, i, j, cnt_y = 0, cnt_n = 0, num[6][4];
    char str[6][4];
    int YES[11] = {0}, NO[11] = {0};

    scanf("%d\n", &N);
    for(i = 0; i < N; i++){
        scanf("%d %d %d %d %s\n", &num[i][0], &num[i][1], &num[i][2], &num[i][3], str[i]);
    }
    for(i = 0; i < N; i++){
        for(j = 0; j < 4; j++){
            if(strcmp(str[i], "YES") == 0){
                YES[num[i][j]]++;
            }else if(strcmp(str[i], "NO") == 0){
                NO[num[i][j]]++;
            }
        }
        if(strcmp(str[i], "YES") == 0)  cnt_y++;
        if(strcmp(str[i], "NO") == 0)  cnt_n++;
    }
    //printf("cnt_y %d cnt_no %d\n", cnt_y, cnt_n);
    for(i = 0; i <= 9; i++){
        if(YES[i] == cnt_y && NO[i] == 0){
            printf("%d\n", i);
        }
    }
    return 0;
}
0