題目連結: https://zerojudge.tw/ShowProblem?problemid=b964

# 程式碼

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	while(cin>>n){
		int point[n];
		for(int i=0;i<n;i++)
			cin>>point[i];
        sort(point,point+n);
		int low=-1,high=101;
		for(int i=0;i<n;i++){
			if(i==n-1)
				cout<<point[i]<<endl;
			else
				cout<<point[i]<<" ";
			if(point[i]<60)
				low=max(low,point[i]);
			else
				high=min(high,point[i]);
		}
		if(low>=0)
			cout<<low<<endl;
		else
			cout<<"best case"<<endl;
		if(high<=100)
			cout<<high<<endl;
		else
			cout<<"worst case"<<endl;
	}
	return 0;
}
更新於 閱讀次數

用實際行動犒賞爆肝的我😀

Zrn Ye LinePay

LinePay