#include <iostream>
#include <math.h>
using namespace std;
int main(){
int x1,y2,x2,y2, r1, r2;
cin >> x1 >> y1 >> endl; //вводим координаты первой точки
cin >> x2 >> y2 >> endl; //вводим координаты второй точки
r1 = sqrt(x1*x1 + y1*y1); //находим расстояние от первой
r2 = sqrt(x2*x2+y2*y2) //от второй
if (r1>r2){
cout << "Точка 1 ближе к началу координат";
}
else{
cout << "Точка 2 ближе к началу координат";
}
else if (r1=r2){
cout << "Эти точки равны"
}
return 0;
}
const
n = 5;
m = 5;
var
a: array[1..n, 1..m] of integer;
i, j: integer;
function check(i: integer): boolean;
var j: integer;
begin
check := false;
j := 0;
repeat
inc(j);
if a[i, j] < 0 then
begin
check := true;
exit;
end;
until j = m;
end;
function search: integer;
var i: integer;
begin
search := 0;
i := 0;
repeat
inc(i);
if not(check(i)) then
begin
search := i;
exit;
end;
until i = n;
end;
begin
writeln('Введите матрицу ', n, 'x', m,': ');
i := 0;
repeat
j := 0;
inc(i);
repeat
inc(j);
read(a[i, j]);
until j = m;
until i = n;
writeln('ответ: ', search);
end.
Пример работы программы:
Введите матрицу 5x5:
3 4 2 3 -2
3 -5 -7 -2 1
8 2 5 4 -4
0 1 2 3 4
1 7 2 -5 2
ответ: 4
* Примечание: Если во всех строках есть отрицательные элементы, то ответ будет 0 (можно изменить в самой процедуре)