В
Все
М
Математика
О
ОБЖ
У
Українська мова
Х
Химия
Д
Другие предметы
Н
Немецкий язык
Б
Беларуская мова
М
Музыка
Э
Экономика
Ф
Физика
Б
Биология
О
Окружающий мир
У
Українська література
Р
Русский язык
Ф
Французский язык
П
Психология
О
Обществознание
А
Алгебра
М
МХК
Г
География
И
Информатика
П
Право
А
Английский язык
Г
Геометрия
Қ
Қазақ тiлi
Л
Литература
И
История
minshinarena
minshinarena
17.05.2020 08:00 •  Информатика

Запишите на алгоритмическом языке алгоритм нахождения количества корней квадратного уравнения исп блок схему

Показать ответ
Ответ:
пупгаз
пупгаз
15.09.2020 04:21

program raf105;

const

 n = 5;

var  

 a: array[1..n,1..n] of integer;

 i,j,num,n1,n2: integer;

begin

writeln('Вводите числа столбцов матрицы по очереди');

for i:=1 to n do

begin

 writeln('Столбец ',i);

 for j:=1 to n do

   readln(a[i,j]);

end;

for i:=1 to n do

begin

 n1:= 0;

 n2:= 0;

 for j:=1 to n do

 begin

   if (a[i,j] mod 2 <> 0) and (a[i,j] <> 0)

     then n1:= n1+1;

 end;

 for j:=1 to n do

 begin

   if (a[i,j] mod 2 = 0) and (a[i,j] <> 0)

     then n2:= n2+1;

 end;

 if n1 > n2

   then num:= i;

end;

writeln('Вывод: ',num);

end.

PascalABC 3.4.2
0,0(0 оценок)
Ответ:
кент63
кент63
28.12.2020 07:58
Uses GraphABC;
const types = 3;
rmax = 4;
CanEat = rmax;
eps = 0.00001;
epsustupi = 0.1;
strahkraj = 3;
ustupi = CanEat*10;
BkColor = clBlack;
Height = 600;
Width = 780;
xmin = 10;
ymin = 10;
xmax = Width - 100;
ymax = Height - 140;
Type
fishtype = class
c, CanRazm, MaxKol, Kol, MaxLife, MinFood: integer;

Speed, See: real;
constructor create(ac, aCanRazm, aMaxKol, aMaxLife, aMinFood:integer; aSpeed, aSee: real);
begin
c:= ac; CanRazm:= aCanRazm; MaxKol:= aMaxKol; Kol:= 1;
MaxLife:= aMaxLife; MinFood:= aMinFood; Speed:= aSpeed; See:= aSee
end;
procedure ShowKol(y: integer);
var s: string;
begin
SetFontColor(c);
TextOut(xmax + 20, y, ' ');
str(Kol, s);
TextOut(xmax + 20, y, s);
end;
end;
var opisanie: array[0..types] of fishtype;
Type
fish = class
x, y, r, dx0, dy0: real;
tip, life, razm, status, food: integer;

next, prev: fish;
constructor Create(ax, ay, ar: real; atip: integer; aprev, anext: fish);
begin
x:= ax; y:= ay; r:= ar; tip:= atip; prev:= aprev; next:= anext;
life:= 0; razm:= 0; dx0:= random; dy0:= random; status:= 1; food:= 0;
end;
procedure show;
begin
SetPenColor(opisanie[tip].c);
circle(round(x), round(y), round(r))
end;
procedure hide;
begin
SetPenColor(BkColor);
circle(round(x), round(y), round(r))
end;
destructor Destroy;
begin
hide;
opisanie[tip].kol:= opisanie[tip].kol - 1;
opisanie[tip].ShowKol(tip*40 + 20);
end;
procedure moveto(dx, dy: real);
begin
hide;
x:= x + dx; y:= y + dy;
if x > xmax then x:= xmax;
if x < xmin then x:= xmin;
if y > ymax then y:= ymax;
if y < ymin then y:= ymin;
show
end;
procedure MakeDeti(var mama, StartAkula, KonAkula, StartKilka, KonKilka : fish);
var d: fish;
begin
razm:= 0;
food:= 0;
d:= fish.create(x, y, r, tip, mama, next);
next.prev:= d;
next:= d;
if mama = KonAkula then KonAkula:= d;
if mama = KonKilka then KonKilka:= d;
opisanie[tip].kol:= opisanie[tip].kol + 1;
opisanie[tip].ShowKol(tip*40 + 20);
end;
procedure step(var ribka, StartAkula, KonAkula, StartKilka, KonKilka : fish);
var i, imin: integer;
dx, dy, d, dx2, dy2, dmin: real;
t, trup, found: fish;
FoundOhot: boolean;
begin
status:= 1;
dx:= 0; dy:= 0;
if tip > 0 then
begin
t:= StartAkula;
if t<>nil then
repeat
d:= sqrt((x - t.x)*(x - t.x) + (y - t.y)*(y - t.y));
if d < opisanie[tip].See then
begin
if d < eps then d:= eps;
dx2:= (x - t.x)/(d*d);
dy2:= (y - t.y)/(d*d);
dx:= dx + dx2;
dy:= dy + dy2;
status:= 2;
end;
t:= t.next
until t = KonAkula.next;
if x - xmin < opisanie[tip].See then dx:= dx + 1/((x - xmin + eps)*strahkraj);
if xmax - x < opisanie[tip].See then dx:= dx + 1/((x - xmax - eps)*strahkraj);
if y - ymin < opisanie[tip].See then dy:= dy + 1/((y - ymin + eps)*strahkraj);
if ymax - y < opisanie[tip].See then dy:= dy + 1/((y - ymax - eps)*strahkraj);
d:= sqrt(dx*dx + dy*dy);
if d < eps then
begin
dx:= 2*status*random*opisanie[tip].Speed - status*opisanie[tip].Speed;
dy:= 2*status*random*opisanie[tip].Speed - status*opisanie[tip].Speed
   
0,0(0 оценок)
Популярные вопросы: Информатика
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота