# zoj1028 Flip and Shift

1. //http://acm.zju.edu.cn/show_problem.php?pid=1028
2. //zoj1028 Flip and Shift

3. //Accepted 1028 C++ 00:00.00 388K
4. #include <stdio.h>

5. int main()

6. {

7. #ifdef ONLINE_JUDGE
8. #else
9.        freopen("1028.txt","r",stdin);

10. #endif

11.        int t,i,n;

12.        int odd,even;
int a;

13.        while (scanf ("%d",&t) != EOF){

14.               while (t--){

15.                      scanf ("%d",&n);

16.                      odd = even = 0;

17.                      for (i=1; i<=n; ++i){

18.                             scanf ("%d",&a);

19.                             if (i%2) odd += a;

20.                             else even += a;

21.                      }

22.                      if (n%2) printf ("YES/n");

23.                      else if ((odd-even)<=1 && (odd-even)>=-1) printf ("YES/n");

24.                      else printf ("NO/n");

25.               }

26.        }

27. #ifdef ONLINE_JUDGE
28. #else
29.        fclose(stdin);

30. #endif

31.        return 0;

32. }

#### ZOJ1028 Flip and Shift

2010-10-01 12:22:00

#### [agc019d]Shift and Flip

2017-10-10 21:40:23

#### Flip and Shift

2011-02-11 17:09:00

#### zoj 1028

2014-08-07 16:09:26

#### 1028 Flip and Shift(规律)

2014-07-01 18:32:54

#### poj 1063 Flip and Shift

2011-07-26 16:16:21

#### Flip and Shift(ZJU_1028)

2006-03-10 16:57:00

#### POJ 1063 - Flip and Shift

2017-02-20 19:38:38

#### poj1063 Flip and Shift

2014-01-02 18:03:38

#### ZOJ 1028 Flip and Shift

2015-05-03 08:49:43