var a: array [1..n, 1..n] of integer; i, j, min: integer;
begin Randomize; Writeln('*** Исходная матрица ***'); for i := 1 to n do begin for j := 1 to n do begin a[i, j] := Random(101) - 50; Write(a[i, j]:4) end; Writeln end; { Собственно, замена } for i := 1 to n do begin min := 32767; for j := 1 to n do if min > a[i, j] then min := a[i, j]; a[i, n - i + 1] := min end; { Результат } Writeln('*** Результирующая матрица ***'); for i := 1 to n do begin for j := 1 to n do Write(a[i, j]:4); Writeln end end.
n = 10;
var
a: array [1..n, 1..n] of integer;
i, j, min: integer;
begin
Randomize;
Writeln('*** Исходная матрица ***');
for i := 1 to n do
begin
for j := 1 to n do
begin a[i, j] := Random(101) - 50; Write(a[i, j]:4) end;
Writeln
end;
{ Собственно, замена }
for i := 1 to n do
begin
min := 32767;
for j := 1 to n do
if min > a[i, j] then min := a[i, j];
a[i, n - i + 1] := min
end;
{ Результат }
Writeln('*** Результирующая матрица ***');
for i := 1 to n do
begin
for j := 1 to n do Write(a[i, j]:4);
Writeln
end
end.
Тестовое решение:
*** Исходная матрица ***
40 7 17 -35 21 2 28 9 6 22
-18 -10 -26 -21 12 2 -40 7 32 -25
-40 -34 -40 16 15 -37 -36 40 7 -3
50 -15 -11 43 -49 -48 -46 -10 48 -31
-26 3 25 38 -39 14 9 -20 46 7
-29 -14 -15 -50 39 23 -4 -49 1 7
-13 39 -49 -42 22 47 -49 -19 -23 10
-2 21 9 12 -49 8 -8 -27 5 -50
5 35 44 -50 -25 14 -50 -12 -46 -21
7 -47 40 -9 33 -15 1 17 -35 -36
*** Результирующая матрица ***
40 7 17 -35 21 2 28 9 6 -35
-18 -10 -26 -21 12 2 -40 7 -40 -25
-40 -34 -40 16 15 -37 -36 -40 7 -3
50 -15 -11 43 -49 -48 -49 -10 48 -31
-26 3 25 38 -39 -39 9 -20 46 7
-29 -14 -15 -50 -50 23 -4 -49 1 7
-13 39 -49 -49 22 47 -49 -19 -23 10
-2 21 -50 12 -49 8 -8 -27 5 -50
5 -50 44 -50 -25 14 -50 -12 -46 -21
-47 -47 40 -9 33 -15 1 17 -35 -36
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cstring>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>typedef unsigned long long ulol;
typedef long double ld;
typedef long long lol;
typedef long int li;#define mp make_pair
#define F first
#define S second
#define sqr(a) ( (a) * (a) )
#define pb push_back
#define INF 999999999
#define ret(a) cout << endl; system("pause"); return(a)
//#define ret(a) return(a)using namespace std;int main()
{
ld x;
cin >> x;
x = ( 8 / sqrt( x ) ) + sqrt(x);
cout << x;
ret(0);
}