2014
02-09

# Be the Winner

Let’s consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.
For example "@@@" can be turned into "@@" or "@" or "@ @"(two piles). two people get apples one after another and the one who takes the last is
the loser. Fra wants to know in which situations he can win by playing strategies (that is, no matter what action the rival takes, fra will win).

You will be given several cases. Each test case begins with a single number n (1 <= n <= 100), followed by a line with n numbers, the number of apples in each pile. There is a blank line between cases.

You will be given several cases. Each test case begins with a single number n (1 <= n <= 100), followed by a line with n numbers, the number of apples in each pile. There is a blank line between cases.

2
2 2
1
3

No
Yes

#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int i,t,n,k,m;
while(cin>>n){
m=0;t=0;
for(i=0;i<n;i++){
cin>>k;
if(k>=2) t++;
m^=k;
}
if((m==0&&t>=2)||(m!=0&&t==0)) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}
return 0;
}

1. 5.1处，反了；“上一个操作符的优先级比操作符ch的优先级大，或栈是空的就入栈。”如代码所述，应为“上一个操作符的优先级比操作符ch的优先级小，或栈是空的就入栈。”

3. 在方法1里面：

//遍历所有的边，计算入度
for(int i=0; i<V; i++)
{
degree = 0;