Pagini recente » Cod sursa (job #446483) | Cod sursa (job #2390950) | Cod sursa (job #671149) | Cod sursa (job #1632314) | Cod sursa (job #407858)
Cod sursa(job #407858)
program num5;
const r=1;
type vec=array [1..1000000] of word;
var i,j,n:word;
st,s0:word;
k,s,min,an,a1,max:word;
sfi:real;
a:vec;
f,t:text;
begin
assign(f,'numere5.in');
reset(f);
assign(t,'numere5.out');
rewrite(t);
read(f,n);
n:=n*n;
for i:=1 to n do
read(f,a[i]);
{-----------------------}
k:=0;s:=0;min:=maxint;max:=0;
for i:=1 to n do
begin
if a[i]<>0 then if a[i]<min then min:=a[i];
if a[i]<>0 then if a[i]>max then max:=a[i];
if a[i]=0 then k:=k+1
else S:=s+a[i];
end;
a1:=1;
an:=a1+(n-1)*r;
st:=((a1+an)*n) div 2;
S0:=St-S;
sfi:=S0*2/k;
a1:=trunc(trunc(sfi-k-1) div 2);
an:=a1+r*(k-1);
{-----------------------}
write(t,a1,' ',an+1);
close(f);
close(t);
end.