|
|
|
@ -28,11 +28,15 @@ input_data(){
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto min = in.numbers[0];
|
|
|
|
|
auto max = in.numbers[0];
|
|
|
|
|
for (auto x : in.numbers) {
|
|
|
|
|
void
|
|
|
|
|
find_minmax(const std::vector<double>& numbers, double& min, double& max, bool& res){
|
|
|
|
|
if (numbers.size() == 0){
|
|
|
|
|
res = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
min = numbers[0];
|
|
|
|
|
max = numbers[0];
|
|
|
|
|
for (auto x : numbers) {
|
|
|
|
|
if (x < min) {
|
|
|
|
|
min = x;
|
|
|
|
|
}
|
|
|
|
@ -40,6 +44,18 @@ int main() {
|
|
|
|
|
max = x;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto min = in.numbers[0];
|
|
|
|
|
auto max = in.numbers[0];
|
|
|
|
|
bool res = true;
|
|
|
|
|
find_minmax(in.numbers, min, max, res);
|
|
|
|
|
if (res == false){
|
|
|
|
|
cerr << "Number of elements cannot be equal to zero";
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
double bin_size = (max - min) / in.bin_count;
|
|
|
|
|
vector<size_t> bins(in.bin_count);
|
|
|
|
|
for (auto x : in.numbers) {
|
|
|
|
|