От двух пристаней расстояние между которыми 44 км одновременно навстречу друг другу направились лодка и байдарка. скорость лодки равна 3км, ч а скорость байдарки 8 км ч. через какое время они встретятся?
Unit main; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; type tform1 = class(tform) memo1: tmemo; edit1: tedit; button1: tbutton; procedure button1click(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.button1click(sender: tobject); var i, j, n: integer; min, max, var_bl: real; a: array of array of real; beginmemo1.clear; if trystrtoint(edit1.text,n) thenbegin n: =strtoint(edit1.text); if n< 1 then begin application.messagebox('ошибка! ','',0); exit; end; setlength(a,n); for i: = 0 to n-1 do setlength(a[i],n); randomize; for i: = 0 to n-1 do for j: =0 to n-1 do a[i,j]: =random(100)-30; min: = a[0,0]; max: = a[0,0]; for i: = 0 to n-1 do begin for j: =0 to n-1 do begin //memo1.text: =memo1.text+floattostrf(a[i,j],fffixed,5,3)+' '; //форматированный вывод memo1.text: =memo1.text+floattostr(a[i,j])+' '; //обычный вывод end; memo1.lines.add(''); end; for i: = 0 to n-1 do for j: =0 to n-1 do begin if(a[i,j]< min) then min: =a[i,j]; if(a[i,j]> max) then max: =a[i,j]; end; memo1.lines.add('min='+floattostr(min)+', max='+floattostr(max)); for i: = 0 to n-1 do for j: =0 to n-1 do begin if(a[i,j]=min) then begin a[i,j]: = max; continue; end; if(a[i,j]=max) then a[i,j]: =min; end; memo1.lines.add(''); memo1.lines.add(''); memo1.lines.add('были поменяны наименьший и наибольший элемент массива'); memo1.lines.add(''); for i: = 0 to n-1 do begin for j: =0 to n-1 do begin //memo1.text: =memo1.text+floattostrf(a[i,j],fffixed,5,3)+' '; //форматированный вывод memo1.text: =memo1.text+floattostr(a[i,j])+' '; //обычный вывод end; memo1.lines.add(''); end; memo1.lines.add(''); memo1.lines.add(''); memo1.lines.add(''); memo1.lines.add(''); end else application.messagebox('ошибка! ','',0); end; end.
dmitrovlug8248
29.10.2021
Const n=10; var a: array[1..n] of integer; i,s1,s2: integer; begin randomize; writeln('массив a: '); for i: =1 to n do begin a[i]: =random(51)-25; write(a[i]: 4); end; writeln; s1: =0; s2: =0; for i: =1 to n do if a[i]< 0 then s1: =s1+a[i] else s2: =s2+a[i]; writeln('s1 = ',s1,' s2 = ',s2); if abs(s1)> s2 then writeln('yes, |',s1,'| > ',s2) else writeln('no, |',s1,'| < = ',s2); end. пример: массив a: -3 16 5 -14 -14 -4 -13 -25 13 16 s1 = -73 s2 = 50 yes, |-73| > 50
1.3+8=11 (км ч) - скорость сближения
2. 44: 11=4 (ч)