Внимание! Если программа не работает, обновите версию Pascal !
begin
var mas:=ArrRandom(15,0,10); mas.Println;
mas.Select((v,i)-> v =0 ? i*i:v).Println;
end.
Import mathn=int(input("Введите скорость"))m=int(input("Введите путь "))print(math.ceil(m/n))Python 3.Среда разработки IDLE
6)
1-b; 2-d; 3-a; 4-c.
7)На C++
#include <iostream>
using namespace std;
int main(void)
{
int age = 0;
cout << "Input your age: ";
cin >> age;
if (age > 18 || age == 18)
cout << "You have the right to vote." << endl;
else
cout << "You don't have the right to vote." << endl;
system("pause");
return 0;
}
{
Если что, часть программы не нужна для построения цепочки. Она просто иллюстрирует, что полученный результат верен.
}
var
sq : array[0..999] of array[0..9] of boolean;
co : array[0..999] of integer;
ar : array[1..10003] of 0..9;
i,j: integer;
x: integer;
t : boolean;
begin
for i := 0 to 999 do
begin
for j := 0 to 9 do
sq[i][j] := false;
co[i] := 0;
end;
for i := 1 to 3 do
ar[i] := 0;
i := 3;
t := true;
{write('000');}
while t do
begin
i := i + 1;
x := ar[i-3]*100 + ar[i-2]*10 + ar[i-1];
if co[x] >= 10 then t := false
else
begin
j := 1;
while sq[x][j] do
j := (j + 1) mod 10;
ar[i] := j;
sq[x][j] := true;
co[x] := co[x] + 1;
{write(j)}
end;
end;
{writeln;}
writeln('Length: ',i - 1);
{просто чтобы убедиться}
for i := 0 to 999 do
for j := 0 to 9 do
sq[i][j] := false;
t := true;
j := 0;
i := 1;
while (i <= 10000) and t do
begin
x := ar[i] * 100 + ar[i+1] * 10 + ar[i+2];
if sq[x][ar[i+3]] then t := false
else
begin
sq[x][ar[i+3]] := true;
j := j + 1;
end;
i := i + 1
end;
if t and (j = 10000) then
write('Confirmed')
<span>end.</span>