Good Game, GG 贪心+思维

Good Game, GG

贪心+思维

只能搞奇数的A : 把奇数每次都减2即可,答案最优 次数为x
偶 B 偶 2 y

搞完后,全为2 或1

如果 x > y 则 A不可能输
= A 必输 (没步走了)
< A 必输 (没步走了)

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int long long
#define fi first
#define se second
#define pb push_back

#define foa(x, y, z) for(int x = (y), ooo = (z); x <= z; ++x)
#define fos(x, y, z) for(int x = (y), ooo = (z); x >= z; --x)
#define ckmax(x, y) ((x) < (y) ? (x) = (y), 1 : 0)
#define ckmin(x, y) ((x) > (y) ? (x) = (y), 1 : 0)

typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 10;
int n, m;

void solve()
{
    cin >> n;
    int a = 0, b = 0;
    foa(i, 1, n) {
        int x;
        cin >> x;
        if(x & 1)
            a += (x + 1) / 2;
        else 
            b += x / 2 - 1;
    }
    if(a > b) cout << "Alice\n";
    else cout << "Bob\n";
//     printf("%d %d\n", a, b);
}
signed main()
{
	// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while(t--)
	solve();
    return 0;
}
posted @   1564269628  阅读(39)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示