結果

問題 No.24 数当てゲーム
ユーザー githide3githide3
提出日時 2018-07-30 20:22:19
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,136 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 28,840 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 13:29:56
合計ジャッジ時間 975 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(void)
{
    int     N, A, B, C, D, i;
    int     r = 0;
    int     n[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    char    R[4];
    int     ans, tmp;

    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d%d%d%d%s", &A, &B, &C, &D, R);
        if (!strcmp(R, "YES")) {
            r |= 1;
            n[A]++;
            n[B]++;
            n[C]++;
            n[D]++;
        } else {
            r |= 2;
            n[A]--;
            n[B]--;
            n[C]--;
            n[D]--;
        }
    }

    if (r == 1) {
        ans = 0;
        for (i = 0; i < 10; i++) {
            if (ans < n[i]) {
                ans = i;
            }
        }
    } else if (r == 2) {
        for (i = 0; i < 10; i++) {
            if (n[i] == 0) {
                ans = i;
                break;
            }
        }
    } else {
        ans = 0;
        tmp = 0;
        for (i = 0; i < 10; i++) {
            if (tmp < (n[i] * n[i])) {
                tmp = n[i] * n[i];
                ans = i;
            }
        }
    }

    printf("%d\n", ans);
    return 0;
}
0