1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include <bits/stdc++.h> #define int long long #define ios ios::sync_with_stdio(0) using namespace std;
void solve(){ int n,arr[25];cin>>n; for(int i=0;i<n;i++)cin>>arr[i]; sort(arr,arr+n); cout<<arr[0]; for(int i=1;i<n;i++)cout<<" "<<arr[i]; cout<<endl; if(arr[0]>=60)cout<<"best case"<<endl; else cout<<*(lower_bound(arr,arr+n,60)-1)<<endl; if(arr[n-1]<60)cout<<"worst case"<<endl; else cout<<*(lower_bound(arr,arr+n,60))<<endl; }
signed main(){ int t; t = 1;
while(t--){ solve(); } }
|