Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Obracanie kartek
- #include <iostream>
- using namespace std;
- int main()
- {
- int c, l;
- cin >> c;
- for(int i = 0; i < c; i++){
- bool kk;
- cin >> l;
- int tab[l];
- for(int j = 0;j < l; j++){cin >> tab[j];}
- if(l == 1){
- if(tab[0] == 1){
- cout << 1;
- continue;
- }
- if(tab[0] == 0){
- cout << 0;
- continue;
- }
- }
- int fst = tab[1];
- kk = false;
- if(l > 2){
- for(int j = 2; j<l; j++){
- if(tab[j] != fst){
- kk = true;
- break;
- }
- }
- }
- if(kk){cout << "NIGDY";}
- else if(tab[0] == 0){
- if(fst == 0)
- cout << 0;
- if(fst == 1)
- cout << 1;
- }
- else if(tab[0] == 1){
- if(fst == 0)
- cout << 2;
- if(fst == 1)
- cout << 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement