1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <string>

using namespace std;

int main(){
	
	int iloscLiter;
	string kodBinarny;
	int iloscJedynek = 0;
	
	cout << "Ile liter? "; cin >> iloscLiter;
	cout << "Jaki kod? "; cin >> kodBinarny;	
	
	if(kodBinarny.size()/iloscLiter != 8){
		
		cout << endl << "Nie";
		exit(0);
	}
	
	for(int i = 0; i < kodBinarny.size(); i++){
		
		
		//cout << kodBinarny[i] << endl;
		if(kodBinarny[i] == '1'){
			
			iloscJedynek++;
			//cout << endl << "Tak";
			
		}	
	
	}
	
	if(iloscJedynek/iloscLiter > 6 || iloscJedynek/iloscLiter < 3){
		
		cout << endl << "Nie";
		exit(0);	

	}
	
	//cout << endl << "Ilosc Jedynek: " << iloscJedynek;
	cout << endl << "niewiem";
	
	
	
	
	
	
	
	return 0;
}