NC222871. GoodGame,GG
描述
输入描述
First line contains one integer ().
In each query:
First line contains one integer ().
Second line contains integers, the -th integer is ().
The sum of is less than .
输出描述
In each query, print Aliceif Alice is the winner, print Bob otherwise.
示例1
输入:
4 3 2 4 6 2 1 2 3 1 1 4 4 2 2 3 6
输出:
Bob Alice Alice Bob
说明:
In first query, there are no odd number, Alice can not make a move, so Bob wins.Python3 解法, 执行用时: 101ms, 内存消耗: 16700K, 提交时间: 2021-07-15 15:29:54
a = int(input()) for i in range(a): cccc=0 con=0 b = int(input()) lis = list(map(int,input().split())) for h in lis: if h%2 == 1: con = con+(h+1)//2 else: cccc = cccc+(h//2-1) if (con>cccc): print("Alice") else: print("Bob")
C++ 解法, 执行用时: 13ms, 内存消耗: 396K, 提交时间: 2022-05-21 13:51:56
#include<bits/stdc++.h> using namespace std; int main(){ int t,n,x; cin>>t; while(t--){ long long s1=0,s2=0; scanf("%d",&n); while(n--){ scanf("%d",&x); if(x&1) s1+=x/2+1; else s2+=x/2-1; } puts(s1>s2?"Alice":"Bob"); } }