int n,m {pt matrice}
int i,j {contoare}
int s {suma}
int min {minimul}
Declara si matricea... stii tu cu declarari etc...
s:=0;
read(n);read(m) {pui eventual writeln('n=')... dar am facut-o rapid}
for i:=1 to n do BEGIN
min:=a[i,1];
for j:=2 to m do BEGIN
if (min>a[i,j]) then
min:=a[i,j];
if( i<>1 AND j<>m AND j<>1 AND i<>n) then
s=s+a[i,j];
END;
writeln("elementul min de pe linia ",i," este", min)
END;
write("Suma el. de pe perimetru este",s);