結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-31 20:46:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 412 ms |
| コンパイル使用メモリ | 36,684 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 03:43:51 |
| 合計ジャッジ時間 | 975 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d %d %d %d %s", &a, &b, &c, &d, r);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
//24
int main() {
char r[4];
int n, a, b, c, d, mask, flag = 0x3ff;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d %d %d %d %s", &a, &b, &c, &d, r);
mask = (1 << a) | (1 << b) | (1 << c) | (1 << d);
if (r[0] == 'Y')
flag &= mask;
else
flag ^= flag & mask;
}
flag--;
flag = (flag & 0x155) + ((flag >> 1) & 0x155);
flag = (flag & 0x333) + ((flag >> 2) & 0x333);
flag = (flag & 0xf0f) + ((flag >> 4) & 0xf0f);
flag = (flag & 0x0ff) + ((flag >> 8) & 0x0ff);
printf("%d\n", flag);
}
AQUA16573837