//Задача 1
begin
var a := ArrRandom(20, -20, 20).Println;
Println(a.Min, ' ', a.Max);
end.
//Задача 2
begin
var a := ReadArrInteger(10);
a.Where(p -> p.IsOdd).Count.Println;
end.
//Задача 3
begin
SeqGen(90, 10, x -> x + 1).Where(x -> x mod 3 = 0).Println;
end.
//Задача 4
begin
ArrRandom(10,-20,20).Println;
end.
//Задача 5
begin
var (a, b) := ReadInteger2;
Range(a, b).Product.Println
end.
//Задача 4
var
n, i, sum, count: integer;
begin
Writeln('Введите число: ');
Readln(n);
count := 0;
while n <> 0 do
begin
i := n mod 10;
sum += i;
count += 1;
n := n div 10;
end;
Writeln('Сумма цифр: ', sum);
Writeln('Количество: ', count);
end.
//Задача 7
var
n, i, sum, count: integer;
begin
Writeln('Введите число: ');
Readln(n);
count := 0;
while n <> 0 do
begin
i := n mod 10;
if not Odd(i) then count += 1;
n := n div 10;
end;
if count <> 0 then Writeln('True')
else Writeln('False');
end.
Задача 8
begin
var n := ReadInteger;
for var i := 1 to n do
begin
Println('Я НЕ учусь программировать');
end;
end.
program t;
var n, i, a, b, c, d, k, m: integer; x1, x2, x3, y1, y2, y3: array[1..10000] of integer; f1, f2: text;
function icl(x, y: integer): boolean;
var i: integer;
begin
icl:=false;
for i:=1 to n do
begin
if (x>=x1[i]) and (y>=y1[i]) and (x<=x2[i]) and (y<=y2[i]) then
begin
icl:=true;
break
end
end
end;
procedure re(st, fn: integer);
var nst, nfn, i, j, jj, xx, yy: integer; eq, ff: boolean;
begin
m:=m+1;
nst:=k+1;
ff:=false;
for i:=st to fn do
begin
for j:=0 to 11 do
begin
if j mod 3=0 then continue;
xx:=x3[i]+trunc(cos(j*pi/6)*3);
yy:=y3[i]+trunc(sin(j*pi/6)*3);
if not icl(xx, yy) then continue;
eq:=false;
for jj:=1 to k do if (xx=x3[jj]) and (yy=y3[jj]) then
begin
eq:=true;
break
end;
if eq then continue;
if (xx=c) and (yy=d) then
begin
ff:=true;
break
end;
k:=k+1;
x3[k]:=xx;
y3[k]:=yy;
end;
if ff then break;
end;
if ff then exit;
nfn:=k;
if nst>nfn then
begin
m:=-1;
exit
end;
re(nst, nfn)
end;
begin
assign(f1, 'horse.in');
reset(f1);
assign(f2, 'horse.out');
rewrite(f2);
readln(f1, n);
for i:=1 to n do readln(f1, x1[i], y1[i], x2[i], y2[i]);
readln(f1, a, b);
readln(f1, c, d);
k:=1;
x3[1]:=a;
y3[1]:=b;
m:=0;
re(1, 1);
writeln(f2, m);
close(f1);
close(f2)
end.