#27899: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
b964. 1. 成績指標 -- 2016年3月apcs | From: [219.85.87.59] | 發表日期 : 2021-11-04 20:09

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
int n, a[21];
while (cin >> n){
int under=-1, upper=101;
for (int i=0; i<n; i++){
cin >> a[i];
if (a[i]<60 && a[i]>under){
under=a[i];
}
if (a[i]>=60 && a[i]<upper){
upper=a[i];
}
}
sort(a, a+n);
for (int i=0; i<n-1; i++){
cout << a[i] <<" ";
}
cout << a[n-1] <<endl;
if (under==-1){
cout <<"best case\n";
}
else {
cout << under <<endl;
}
if (upper==101){
cout <<"worst case\n";
}
else {
cout << upper <<endl;
}
}
}
 
ZeroJudge Forum