Ответ:
program arrmax;
var
i, i1, i2, amax: Integer;
a: array [1..10] of integer;
begin
Randomize;
for i := 1 to 10 do // заполнение массива случайными числами
a [i] := Random (11);
for i := 1 to 10 do // вывод на экран элементов массива
Write (a [i], ' ');
amax := -1;
i1 := -1;
for i := 1 to 10 do // поиск первого максимального элемента
if a [i] > amax then begin
amax := a [i];
i1 := i;
end;
WriteLn;
WriteLn ('Индекс первого элемента массива с наибольшим значением = ', i1);
amax := -1;
i2 := -1;
for i := 10 downto 1 do // поиск последнего максимального элемента
if a [i] > amax then begin
amax := a [i];
i2 := i;
end;
WriteLn ('Индекс последнего элемента массива с наибольшим значением = ', i2);
ReadLn;
end.
Объяснение:
По формуле <span>N=2i</span> находим 64=<span>2i</span>, 26=<span>2i</span>,i=6. По формуле I=K*i I<span>=</span>1 977 × 6 = 11 862
№1
37 = 100101
64 = 1000000
121= 1111001
307= 100110011
511 = 111111111
91 = 1011011
366 = 101101110
404 = 110010100
717 = 1011001101
1228 = 10011001100
№2
101010= 42
100100=36
11111= 31
101110= 46
1100011=99
1001010=74
1100010000=784
101110001=369
1000001=65
1011001=89
Unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
x,y,t:real;
x1,y1,M:integer; //M -коэффициент масштабирования
begin
x1:=Image1.Width div 2;
y1:=Image1.Height div 2;
with Image1.Canvas do
begin
MoveTo(x1,0); LineTo(x1,Image1.Height);
MoveTo(x1,0); LineTo(x1-5,10);
MoveTo(x1,0);LineTo(x1+5,10);
MoveTo(0,y1);LineTo(Image1.Width,y1);
LineTo(Image1.Width-10,y1-5);
MoveTo(Image1.Width,y1); LineTo(Image1.Width-10,y1+5);
TextOut(x1+1,y1+1,'0');
TextOut(Image1.Width-16,y1+2,'X');
TextOut(x1-15,0,'Y');
x := -200;
y := 1/x;
M:=strtoint(edit1.text);
moveto(x1+round(x)*M,(y1-round(y)*M));
repeat
x:=x+0.1;
if x<>0 then //точка разрыва
begin
y := 1/x;
lineto(x1+round(x*M),(y1-round(y*M)));
end
else
begin
x:=x+0.1;
y := 1/x;
MoveTo(x1+round(x*M),(y1-round(y*M)));
end;
until x>=200;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Label1.Caption:='коэффициент масштабирования';
Button1.Caption:='Построить';
Edit1.Text:='15';
Button1.OnClick(sender);//Построение
end;
end.