发布网友 发布时间:2024-10-23 19:20
共3个回答
热心网友 时间:2024-11-09 19:56
var n,s,t,i,max,min:longint;
begin
readln(n);min:=maxlongint;
for i:=1 to n do
begin
read(t);
inc(s,t);
if min>t then min:=t;
if max<t then max:=t;
end;
writeln((s-min-max)/(n-2):0:2);
end.
热心网友 时间:2024-11-09 19:57
var
a:array[1..100] of longint;
n,i,tot:longint;
ans:real;
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end;
begin
readln(n);
for i:=1 to n do read(a[i]);
sort(1,n);
tot:=0;
for i:=2 to n-1 do inc(tot,a[i]);
ans:=tot/(n-2);
writeln(ans:0:2);
end.
热心网友 时间:2024-11-09 19:54
var
a:array[1..100] of longint;
n,i,tot:longint;
ans:real;
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end;
begin
readln(n);
for i:=1 to n do read(a[i]);
sort(1,n);
tot:=0;
for i:=2 to n-1 do inc(tot,a[i]);
ans:=tot/(n-2);
writeln(ans:0:2);
end.