Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int d;
- int tab[11][10001];
- cin >> d;
- for (int i = 0; i < d; i++) {
- cin >> tab[i][0];
- for (int j = 1; j <= tab[i][0] ; j++) {
- cin >> tab[i][j];
- }
- }
- for (int i = 0; i < d; i++) {
- // jedna katka
- if (tab[i][0] == 1) {
- if (tab[i][1] == 1) {
- cout << 1 << "\n";
- } else if (tab[i][1] == 0) {
- cout << 0 << "\n";
- }
- }
- //zaczynające się od 1 ...
- else if (tab[i][1] == 1){
- // 1 1 ...
- if (tab[i][2] == 1) {
- for (int z = 3; z <= tab[i][0] ; z++) {
- if ((tab[i][z-1]) != (tab[i][z])) {
- cout << "NIGDY" << "\n";
- break;
- } else {
- cout << "1" << "\n";
- }
- }
- }
- // 1 0 ...
- if (tab[i][2] == 0) {
- for (int z = 3; z <= tab[i][0] ; z++) {
- if ((tab[i][z-1]) != (tab[i][z])) {
- cout << "NIGDY";
- break;
- } else {
- cout << "2" << "\n";
- }
- }
- }
- } // zaczynające się od 0 ...
- else if (tab[i][1] == 0) {
- // 0 1 ...
- if (tab[i][2] == 1) {
- for (int z = 3; z <= tab[i][0] ; z++) {
- if ((tab[i][z-1]) != (tab[i][z])) {
- cout << "NIGDY" << "\n";
- break;
- } else {
- cout << "1" << "\n";
- }
- }
- }
- // 0 0 ...
- if (tab[i][2] == 0) {
- for (int z = 3; z <= tab[i][0] ; z++) {
- if ((tab[i][z-1]) != (tab[i][z])) {
- cout << "NIGDY" << "\n";
- break;
- } else {
- cout << "0" << "\n";
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement