| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3,26 +3,29 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using namespace std;
 | 
					 | 
					 | 
					 | 
					using namespace std;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					int main()
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 4;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					struct Input{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					vector<double> numbers;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    size_t bin_count{};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					Input
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					input_data(){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    Input in;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter number count:";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter numbers" << "\n";
 | 
					 | 
					 | 
					 | 
					    in.numbers.resize(number_count);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<double> numbers(number_count);
 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for(size_t i = 0; i < number_count; ++i){
 | 
					 | 
					 | 
					 | 
					        cin >> in.numbers[i];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cerr << i + 1 << ":";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cin >> numbers[i];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t bin_count;
 | 
					 | 
					 | 
					 | 
					    cin >> in.bin_count;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter bins count:";
 | 
					 | 
					 | 
					 | 
					    return in;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> bin_count;
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double min = numbers[0];
 | 
					 | 
					 | 
					 | 
					void
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double max = numbers[0];
 | 
					 | 
					 | 
					 | 
					find_minmax(vector<double> numbers, double& min, double& max) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    min = numbers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    max = numbers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (double x : numbers) {
 | 
					 | 
					 | 
					 | 
					    for (double x : numbers) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (x < min) {
 | 
					 | 
					 | 
					 | 
					        if (x < min) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            min = x;
 | 
					 | 
					 | 
					 | 
					            min = x;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -31,26 +34,34 @@ int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            max = x;
 | 
					 | 
					 | 
					 | 
					            max = x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t max_count = 0;
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					vector<size_t>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					make_histogram(vector<double> numbers, int bin_count){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    double min = numbers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    double max = numbers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    find_minmax(numbers, min, max);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++) {
 | 
					 | 
					 | 
					 | 
					    for (auto x: numbers) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        bool found = false;
 | 
					 | 
					 | 
					 | 
					        bool found = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (size_t j = 0; (j < bin_count - 1) && !found; j++) {
 | 
					 | 
					 | 
					 | 
					        for (size_t j = 0; (j < bin_count - 1) && !found; j++) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            auto lo = min + j * bin_size;
 | 
					 | 
					 | 
					 | 
					            auto lo = min + j * bin_size;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            auto hi = min + (j + 1) * bin_size;
 | 
					 | 
					 | 
					 | 
					            auto hi = min + (j + 1) * bin_size;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if ((lo <= numbers[i]) && (numbers[i] < hi)) {
 | 
					 | 
					 | 
					 | 
					            if ((lo <= x) && (x < hi)) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                found = true;
 | 
					 | 
					 | 
					 | 
					                found = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(bins[j] > max_count) max_count = bins[j];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!found) {
 | 
					 | 
					 | 
					 | 
					        if (!found) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(bins[bin_count - 1] > max_count) max_count = bins[bin_count - 1];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if(max_count <= MAX_ASTERISK){
 | 
					 | 
					 | 
					 | 
					    return bins;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					void
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					show_histogram_text(vector<size_t> bins){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for(size_t count: bins){
 | 
					 | 
					 | 
					 | 
					    for(size_t count: bins){
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (count < 100) cout << " ";
 | 
					 | 
					 | 
					 | 
					        if (count < 100) cout << " ";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (count < 10) cout << " ";
 | 
					 | 
					 | 
					 | 
					        if (count < 10) cout << " ";
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -58,26 +69,11 @@ int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for(size_t i = 0; i < count; ++i) cout << "*";
 | 
					 | 
					 | 
					 | 
					    for(size_t i = 0; i < count; ++i) cout << "*";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cout << "\n";
 | 
					 | 
					 | 
					 | 
					        cout << "\n";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    else{
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for(size_t count: bins){
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (count < 100) cout << " ";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (count < 10) cout << " ";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cout << count << "|";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        size_t height = MAX_ASTERISK * (static_cast<double>(count) / max_count);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for(size_t i = 0; i < height; ++i) cout << "*";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cout << "\n";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					cout << "\n";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					for(size_t i = 0; i < max_count; ++i){
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for(size_t j = 0; j < bin_count; ++j){
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(bins[j] > i) cout << "*";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else cout << " ";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cout << "\n";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    auto in = input_data();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    auto bins = make_histogram(in.numbers, in.bin_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    show_histogram_text(bins);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |