| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2,29 +2,36 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <vector>
 | 
					 | 
					 | 
					 | 
					#include <vector>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using namespace std;
 | 
					 | 
					 | 
					 | 
					using namespace std;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					int main()
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{
 | 
					 | 
					 | 
					 | 
					struct Input {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
					 | 
					 | 
					 | 
					    vector<double> numbers;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
					 | 
					 | 
					 | 
					    size_t bin_count{};
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //ââîä ÷èñëà ýëåìåíòîâ ìàññèâà
 | 
					 | 
					 | 
					 | 
					};
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					Input input_data() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
					 | 
					 | 
					 | 
					    size_t number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter number count: ";
 | 
					 | 
					 | 
					 | 
					    cerr << "Enter number count: ";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
					 | 
					 | 
					 | 
					    cin >> number_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //èíèöèàëèçàöèÿ ìàññèâà ÷èñåë è çàïîëíåíèå
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<double> numbers(number_count);
 | 
					 | 
					 | 
					 | 
					    Input in;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    in.numbers.resize(number_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++)
 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cin >> numbers[i];
 | 
					 | 
					 | 
					 | 
					        cin >> in.numbers[i];
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //ââîä ÷èñëà êîðçèí
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t bin_count;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cerr << "Enter number bin: ";
 | 
					 | 
					 | 
					 | 
					    cerr << "Enter number bin: ";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    cin >> bin_count;
 | 
					 | 
					 | 
					 | 
					    cin >> in.bin_count;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //èíèöèàëèçàöèÿ ìàññèâà êîðçèí
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
					 | 
					 | 
					 | 
					    return in;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //ïîèñêè ýêñòðåìóìîâ
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double min = numbers[0];
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double max = numbers[0];
 | 
					 | 
					 | 
					 | 
					void find_minmax(const 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)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -36,16 +43,24 @@ int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            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);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
					 | 
					 | 
					 | 
					    double bin_size = (max - min) / bin_count;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //ðàñïðåäåëåíèå ïî êîðçèíàì
 | 
					 | 
					 | 
					 | 
					    vector<size_t> bins(bin_count);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < number_count; i++)
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    for (double number : 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 <= number) && (number < hi))
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
					 | 
					 | 
					 | 
					                bins[j]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                found = true;
 | 
					 | 
					 | 
					 | 
					                found = true;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -56,7 +71,15 @@ int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
					 | 
					 | 
					 | 
					            bins[bin_count - 1]++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //âûâîäû ðåçóëüòàòîâ
 | 
					 | 
					 | 
					 | 
					    return bins;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					void show_histogram_text(const vector<size_t>& bins, size_t bin_count) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    const size_t SCREEN_WIDTH = 80;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    Input in;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    size_t max_count = bins[0];
 | 
					 | 
					 | 
					 | 
					    size_t max_count = bins[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bin_count; i++)
 | 
					 | 
					 | 
					 | 
					    for (size_t i = 0; i < bin_count; i++)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					    {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -91,6 +114,12 @@ int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cout << endl;
 | 
					 | 
					 | 
					 | 
					        cout << endl;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					int main()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    auto in = input_data();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    auto bins = make_histogram(in.numbers, in.bin_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    show_histogram_text(bins, in.bin_count);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return 0;
 | 
					 | 
					 | 
					 | 
					    return 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |