結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  rsk0315 | 
| 提出日時 | 2020-02-24 17:13:21 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 420 bytes | 
| コンパイル時間 | 304 ms | 
| コンパイル使用メモリ | 28,032 KB | 
| 最終ジャッジ日時 | 2025-01-09 02:04:08 | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
main.cpp:13:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |       scanf("%d", &a);
      |       ~~~~~^~~~~~~~~~
main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%s", r);
      |     ~~~~~^~~~~~~~~
            
            ソースコード
#include <cstdio>
int main() {
  int n;
  scanf("%d", &n);
  int no = 0;
  int yes = (1 << 10) - 1;
  for (int i = 0; i < n; ++i) {
    int cur = 0;
    for (int j = 0; j < 4; ++j) {
      int a;
      scanf("%d", &a);
      cur |= 1 << a;
    }
    char r[4];
    scanf("%s", r);
    if (r[0] == 'Y') {
      yes &= cur;
    } else {
      no |= cur;
    }
  }
  yes &= ~no;
  printf("%d\n", __builtin_ctz(yes));
}
            
            
            
        