#include <iostream>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
int std,std1,score1,score2;
cin>>std;
std1=std-1;
int score[20];
for( int i=0; i<std; i++ )
{
cin >> score[i];
}
sort(score,score+std);
for( int i=0; i<std; i++ )
{
cout << score[i] << " " ;
}
cout <<'\n';
for(int i = std-1; i >= 0; i-- )
{
if (score[i] < 60)
{
score1 = i;
break;
}
}
score1=score1+1;
score2=score1-1;
//------------------------------------------
if(score[0]>=60)
{
cout << "best case"<<'\n'<<score[0];
}
else
{
if(score[0]<60 and score[std1]>=60)
{
cout<<score[score2]<<'\n'<<score[score1];
}
else
{
cout<<score[std1]<<'\n'<< "worst case ";
}
}
return 0;
}
#include <iostream>
#include <algorithm>using namespace std;
int a[25];
int main()
{
int n, low = -1, high = -1;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n; i++) {
if (a[i] < 60) {
low = a[i];
}
}
for (int i = 0; i < n; i++) {
if (a[i] >= 60) {
high = a[i];
break;
}
}for (int i = 0; i < n; i++) {
cout << a[i] << " ";
}
cout << '\n';if (low != -1) {
cout << low << '\n';
}
else {
cout << "best case" << '\n';
}
if (high != -1) {
cout << high << '\n';
}
else {
cout << "worst case" << '\n';
}
}