#include <iostream>
#include <cmath>
using namespace std;
signed main() {
int n;
cin >> n;
double a[n];
for(int i = 0; i < n; i++)
cin >> a[i];
double mx = -10000000000000;
for(int i = n/2; i < n; i++)
mx = max(mx,a[i]);
for(int i = 0; i < n-1; i++)
for(int j = 0; j < n - i - 1; j++)
if(a[j] > a[j+1])
{
double temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
cout << "maximal element of the second half: " << mx <<"\n";
cout << "array after sorting: " << "\n";
for(auto i: a)
cout << i << " ";
#include <iostream>
#include <cmath>
using namespace std;
signed main() {
int n;
cin >> n;
double a[n];
for(int i = 0; i < n; i++)
cin >> a[i];
double mx = -10000000000000;
for(int i = n/2; i < n; i++)
mx = max(mx,a[i]);
for(int i = 0; i < n-1; i++)
for(int j = 0; j < n - i - 1; j++)
if(a[j] > a[j+1])
{
double temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
cout << "maximal element of the second half: " << mx <<"\n";
cout << "array after sorting: " << "\n";
for(auto i: a)
cout << i << " ";
}
#include <iostream>
#include <cmath>
using namespace std;
signed main() {
int n;
cin >> n;
double a[n];
for(int i = 0; i < n; i++)
cin >> a[i];
double mx = -10000000000000;
for(int i = n/2; i < n; i++)
mx = max(mx,a[i]);
for(int i = 0; i < n-1; i++)
for(int j = 0; j < n - i - 1; j++)
if(a[j] > a[j+1])
{
double temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
cout << "maximal element of the second half: " << mx <<"\n";
cout << "array after sorting: " << "\n";
for(auto i: a)
cout << i << " ";
}