Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int ile;
- cin >> ile;
- for(int i = 0; i < ile; i++){
- int n;
- string a = "";
- cin >> n;
- for(int j = 0; j< n; j++){
- char x;
- cin >> x;
- a += x;
- }
- string jeden(n, '0');
- string dwa(n, '1');
- string trzy(n, '0');
- trzy[0] = '1';
- string cztery(n, '1');
- cztery[0] = '0';
- if(jeden == a){
- cout << "0" << endl;
- } else if(dwa == a){
- cout << "1" << endl;
- } else if(trzy == a){
- cout << "2" << endl;
- } else if(cztery == a){
- cout << "1" << endl;
- } else {
- cout << "NIGDY" << endl;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment