結果

問題 No.24 数当てゲーム
ユーザー HimatsubushinHimatsubushin
提出日時 2019-12-18 11:34:38
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 777 bytes
コンパイル時間 775 ms
コンパイル使用メモリ 28,584 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 08:04:04
合計ジャッジ時間 1,495 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(void) {
    int i, j, n, max, pos;
    int d[4], yes[10], no[10];
    char b[4];

    for (i = 0; i < 10; i++) {
        yes[i] = 1;
        no[i] = 0;
    }

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        for (j = 0; j < 4; j++)
            scanf("%d", &d[j]);
        scanf("%s", b);

        if (strcmp(b, "YES") == 0)
            for (j = 0; j < 4; j++)
                yes[d[j]]++;
        else
            for (j = 0; j < 4; j++)
                no[d[j]]++;
    }

    for (i = 0; i < 10; i++)
        if (no[i] > 0)
            yes[i] =0;

    max = 0;
    for (i = 0; i < 10; i++)
        if (max < yes[i]) {
            max = yes[i];
            pos = i;
        }

    printf("%d\n", pos);

    return 0;
}
0