• Source
    1. /**************************************************************
    2.   Problem: 1115
    3.   User: zrts
    4.   Language: C++
    5.   Result: Accepted
    6.   Time:24 ms
    7.   Memory:812 kb
    8. ****************************************************************/
    9.  
    10. #include<cstdio>
    11. #include<cstring>
    12. #include<algorithm>
    13. //by zrt
    14. //problem:
    15. using namespace std;
    16. typedef long long ll;
    17. const double eps(1e-10);
    18. int n,a[1005],b[1005];
    19. int main(){
    20. #ifdef LOCAL
    21. freopen("in.txt","r",stdin);
    22. freopen("out.txt","w",stdout);
    23. #endif
    24. int tt;
    25. scanf("%d",&tt);
    26. while(tt--){
    27. scanf("%d",&n);
    28. for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    29. for(int i=1;i<=n;i++) b[i-1]=a[i]-a[i-1];
    30. int sg=0;
    31. for(int i=0;i<n;i++){
    32. if((i&1)!=(n&1)){
    33. sg^=b[i];
    34. }
    35. }
    36. if(sg){
    37. puts("TAK");
    38. }else{
    39. puts("NIE");
    40. }
    41. }
    42. return 0;
    43. }