O(n^2)很容易就看出时间短的排在前面平均等待时间就越小,数据又不大,冒泡排序,时间累加起来除以人数,就是平均等待时间了。var i,j,k,n:longint; l,t:int64; a,b:array[1..50000] of longint;begin readln(n); for i:=1 to n do begin read(a[i]); b[i]:=i; end; for i:=1 to n-1 do for j:=i+1 to n do if a[i]>a[j] then begin k:=a[i];a[i]:=a[j];a[j]:=k; k:=b[i];b[i]:=b[j];b[j]:=k; end; t:=a[1]; for i:=2 to n do begin l:=l+t; t:=t+a[i]; end; for i:=1 to n do write(b[i],' '); writeln; writeln(l/n:0:2);end.