d153.
六、智力测验
--
NOI冬令营
| From: [112.64.190.44] |
發表日期
:
2011-07-13 15:44
var
a,b : array[1..40000] of byte;
n,i,j,k,l,m,p,q : longint;
begin
readln(n);
for i :=1 to n do begin
readln(m);
for j :=1 to m do readln(a[j]);
k :=0;
for j :=1 to m do if a[j]>k then k :=a[j];
l :=900;
for j :=1 to m do if a[j]<l then l :=a[j];
for j :=1 to m do
b[j] :=abs(a[j]-(k+l) div 2);
q :=400;
p :=0;
for j :=1 to m do if (b[j]<q) and (q<j) then begin
p :=j;
q :=b[j];
end;
writeln(a[p]);
end
end.