intmain(){ //1.数据存储 cin >> n; for (int i = 1; i <= n; ++i) { cin >> stu[i].time; stu[i].cnt = i; } //2.数据处理 sort(stu + 1, stu + n + 1, cmp); int sum = 0;//总打水时间 int now = 0;//某个同学的打水等待时间 for (int i = 1; i <= n; ++i) { if (i != 1) cout << " "; cout << stu[i].cnt; sum += now; now += stu[i].time; } cout << endl; printf("%.2f\n", (double)sum / n); return0; }