| 
						
						
						
					 | 
					 | 
					@ -1,81 +1,78 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <iostream>
 | 
					 | 
					 | 
					 | 
					#include <iostream>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <vector>
 | 
					 | 
					 | 
					 | 
					#include <vector>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <algorithm>  // Äëÿ std::min è std::max (åñëè âû åùå íå âêëþ÷èëè)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using namespace std;
 | 
					 | 
					 | 
					 | 
					using namespace std;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					struct Input {
 | 
					 | 
					 | 
					 | 
					int main()
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<double> numbers;
 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t bin_count{};
 | 
					 | 
					 | 
					 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					};
 | 
					 | 
					 | 
					 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					Input
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					input_data() {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    Input in;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter number count: ";
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    cerr << "Enter number count: ";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    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];
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        cin >> numbers[i];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    size_t bin_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter number bin: ";
 | 
					 | 
					 | 
					 | 
					    cerr << "Enter number bin: ";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> in.bin_count;
 | 
					 | 
					 | 
					 | 
					    cin >> bin_count;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return in;
 | 
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void
 | 
					 | 
					 | 
					 | 
					    double min = numbers[0];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					find_minmax(const vector<double>& numbers, double& min, double& max) {
 | 
					 | 
					 | 
					 | 
					    double max = numbers[0];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    min = numbers[0];
 | 
					 | 
					 | 
					 | 
					    for (double x : numbers)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    max = numbers[0];
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (double x : numbers) {
 | 
					 | 
					 | 
					 | 
					        if (x < min)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (x < min) {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            min = x;
 | 
					 | 
					 | 
					 | 
					            min = x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (x > max) {
 | 
					 | 
					 | 
					 | 
					        else if (x > max)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            max = x;
 | 
					 | 
					 | 
					 | 
					            max = x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					vector<size_t>
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					make_histogram(const vector<double>& numbers, size_t bin_count) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double min, max;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    find_minmax(numbers, min, max);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < numbers.size(); i++) {
 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        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 <= numbers[i]) && (numbers[i] < hi))
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                found = true;
 | 
					 | 
					 | 
					 | 
					                found = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (!found) {
 | 
					 | 
					 | 
					 | 
					        if (!found)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return bins;
 | 
					 | 
					 | 
					 | 
					    size_t max_count = bins[0];
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bin_count; i++)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (bins[i] > max_count) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            max_count = bins[i];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void
 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bin_count; i++)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					show_histogram_text(const vector<size_t>& bins, size_t max_count, size_t MAX_ASTERISK) { // Óáðàëè bin_count ò.ê. åñòü bins.size()
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bins.size(); i++) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (bins[i]<10) {
 | 
					 | 
					 | 
					 | 
					        if (bins[i]<10) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cout << "  " << bins[i] << "|";
 | 
					 | 
					 | 
					 | 
					            cout << "  " << bins[i] << "|";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else if (bins[i] < 100) {
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        else if (bins[i]<100) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cout << " " << bins[i] << "|";
 | 
					 | 
					 | 
					 | 
					            cout << " " << bins[i] << "|";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else if (bins[i] < 1000) {
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        else if (bins[i]<1000) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            cout << bins[i] << "|";
 | 
					 | 
					 | 
					 | 
					            cout << bins[i] << "|";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -83,7 +80,8 @@ show_histogram_text(const vector<size_t>& bins, size_t max_count, size_t MAX_AST
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (max_count<=MAX_ASTERISK) {
 | 
					 | 
					 | 
					 | 
					        if (max_count<=MAX_ASTERISK) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            height = bins[i];
 | 
					 | 
					 | 
					 | 
					            height = bins[i];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else {
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            height = MAX_ASTERISK * (static_cast<double>(bins[i]) / max_count);
 | 
					 | 
					 | 
					 | 
					            height = MAX_ASTERISK * (static_cast<double>(bins[i]) / max_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (size_t j = 0; j < height; j++) {
 | 
					 | 
					 | 
					 | 
					        for (size_t j = 0; j < height; j++) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -91,23 +89,6 @@ show_histogram_text(const vector<size_t>& bins, size_t max_count, size_t MAX_AST
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cout << endl;
 | 
					 | 
					 | 
					 | 
					        cout << endl;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					int
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					main() {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    auto in = input_data();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    auto bins = make_histogram(in.numbers, in.bin_count);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t max_count = bins[0];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bins.size(); i++) { // Èñïðàâèëè öèêë íà bins.size()
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (bins[i] > max_count) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            max_count = bins[i];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    show_histogram_text(bins, max_count, MAX_ASTERISK);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return 0;
 | 
					 | 
					 | 
					 | 
					    return 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |