经过昨天那道题,今天这道就很简单了,就算不知道哪种顺序最佳,看给出的实例就能看从小到大排序,而且最后计算平均等待时间的时候也就明白为啥这样排最省时了。
看题解提供一种思路:换一种存数据的方式
struct wt{
int o;
int t;
}a[1001];
bool cmp(wt x,wt y) {
return x.t<y.t;
}
int main() {
int n;
double s=0;
cin>>n;
for (int i=0;i<n;i++) {
cin>>a[i]