题解 | 浮木博弈

浮木博弈

https://www.nowcoder.com/practice/8c70e6107d37468e9f6ad2b25ff167bf

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;cin>>n;
        int tmp;
        bool flag=1;int count=0;
        for(int i=0;i<n;i++)
        {
            cin>>tmp;
            if(tmp==1&&flag&&i!=n-1)
            {
                count++;
            }
            else flag=0;
        }
        if(count%2==0)
            cout<<"Alice"<<endl;
        else
            cout<<"Bob"<<endl;
    }
}

全部评论

相关推荐

LZHR:老哥你从投递简历测评完到一面中间隔了多久呀,我这边已经过了五天了仍显示简历筛选中是不是就是挂了
腾讯求职进展汇总
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务