糖果游戏_求救(看看错哪了 WA 10)

using namespace std;
int n;
long long a[1000005];
long long a_sum=0;
long long b_sum=0;
int main(){
	cin>>n;
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1,greater<int>() );
	for(int i=1;i<=n;i++){
		if(i%2){
			if(a[i]%2==0){
				a_sum+=a[i];
			}
		}else{
			if(a[i]%2){
				b_sum+=a[i];
			}
		}
	}
	if(a_sum<b_sum){
		cout<<"Bob";
	}else if(a_sum==b_sum){
		cout<<"wow";
	}else{
		cout<<"Alice";
	}
	return 0;
}

1 个赞

freopencin >> n;

2 个赞