結果

問題 No.2813 Cookie
ユーザー tnakao0123
提出日時 2024-07-22 17:52:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 40,576 KB
最終ジャッジ日時 2025-02-23 17:52:15
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |   scanf("%d", &tn);
      |   ~~~~~^~~~~~~~~~~
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:32:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |     for (int i = 0; i < n; i++) scanf("%d", as + i);
      |                                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2813.cc:  No.2813 Cookie - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", as + i);

    int x = 0;
    for (int i = 0; i < n; i++) x ^= (as[i] + 1) / 2;

    if (x > 0) puts("Alice");
    else puts("Bob");
  }

  return 0;
}
0