codeforces 1147 C

一开始考虑到了1的个数。。。
后来发现应该是最小值的个数。
考虑两种情况。
最小值的个数不大于一半,那么我们可以选一些石子使得最小值的个数大于一半。
最小值的个数大于一半的话,我们不管怎么选,都会使得最小值的个数小于一半。

然后我们很容易发现后者是必败态,比方说1111这样子。
那么前者就是必胜态了。

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a[55];
int main(){
    ios::sync_with_stdio(false);
    cin>>n;int tmp = 0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(a[i]==*min_element(a+1,a+1+n))tmp++;
    }
    if(tmp<=n/2){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Bob"<<endl;
    }
}

猜你喜欢

转载自www.cnblogs.com/MXang/p/11391730.html