hdu_5146

 1 #include "cstdio"

 2 

 3 #define MaxN 1111

 4 #define ACCEPT

 5 

 6 bool is_palindrome;

 7 int case_num, n, arr[MaxN];

 8 long long even_sum, odd_sum;

 9 

10 int main()

11 {

12     #ifndef ACCEPT

13         freopen("in.txt","r",stdin);        

14     #endif

15     scanf("%d",&case_num);

16     while(case_num--){

17         even_sum = odd_sum = 0;

18         is_palindrome = true;

19         scanf("%d",&n);

20         for(int i = 0; i < n; ++i){

21             scanf("%d",&arr[i]);

22             if(i&1)

23                 even_sum += arr[i];

24             else

25                 odd_sum += arr[i];

26             if(is_palindrome == true && i >= n>>1 && arr[i] != arr[n-i-1])

27                     is_palindrome = false;

28         }

29         if(even_sum == odd_sum && is_palindrome == false)

30             puts("Yes");

31         else

32             puts("No");

33     }

34 }

 

你可能感兴趣的:(HDU)