結果

問題 No.24 数当てゲーム
ユーザー pro_kunipro_kuni
提出日時 2018-06-16 22:15:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,071 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 53,292 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 06:16:28
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 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 <iostream>
#include <bitset>
#define MASK1 0x0001
#define MASK2 0x0002
#define MASK3 0x0004
#define MASK4 0x0008
#define MASK5 0x0010
#define MASK6 0x0020
#define MASK7 0x0040
#define MASK8 0x0080
#define MASK9 0x0100
#define MASK10 0x0200

using namespace std;

int main() {
    int n;
    int mask, base = 0xffff, masks[10] = {MASK1, MASK2, MASK3, MASK4, MASK5, MASK6, MASK7, MASK8, MASK9, MASK10};
    int predict, cut = 0xfc00;
    string judge;

    cin >> n;
    for (int i = 0; i < n; i++) {
        mask = 0x0000;
        for (int j = 0; j < 4; j++) {
            cin >> predict;
            mask = mask | masks[predict];
        }
        //cout << "mask: " << bitset<16>(mask) << endl;
        cin >> judge;
        if (judge == "YES") {
            base = base & mask;
        } else if (judge == "NO") {
            base = base & ~mask;
        }
        //cout << bitset<16>(base) << endl;
    }
    base = base & ~cut;
    for (int i = 0; i < 10; i++) {
        if (masks[i] == base) {
            cout << i << endl;
        }
    }
    return 0;
}
0