var a:integer;
begin
writeln('Days Of Week');
readln(a);
case a of
1: write('Monday');
2: write('Tuesday');
3: write('Wednesday');
4: write('Thursday');
5: write('Friday');
6: write('Saturday');
7: write('Sunday');
end;
end.
45 раз
Он будет прибавлять единицу к n 45 раз.
6 - минимальное количество ходов, за которое можно добраться до любой клетки.
Программа на паскале:
const
m = 7;
n = 9;
p = n*m;
dx: array [1..8] of integer = (-2, -1, 1, 2, 2, 1, -1, -2);
dy: array [1..8] of integer = (1, 2, 2, 1, -1, -2, -2, -1);
var
a: array [1..m, 1..n] of integer;
x,y: array [1..p] of integer;
i,j,l: integer;
t: boolean;
begin
for i := 1 to p do
begin
x[i] := -1;
y[i] := -1;
end;
for i := 1 to m do
for j := 1 to n do
a[i,j] := -1;
a[1,1] := 0;
x[1] := 1;
y[1] := 1;
l := 1;
for i := 1 to p do
if x[i] <> - 1 then
for j := 1 to 8 do
if (x[i] + dx[j] > 0) and (x[i] + dx[j] <= m) then
if (y[i] + dy[j] > 0) and (y[i] + dy[j] <= n) then
if a[ x[i] + dx[j], y[i] + dy[j] ] = -1 then
begin
l := l + 1;
x[l] := x[i] + dx[j];
y[l] := y[i] + dy[j];
a[ x[l], y[l] ] := a[ x[i], y[i] ] + 1;
end;
for i := 1 to p do if x[i] <> -1 then
writeln(i:2,' - ',x[i],':',y[i],' - ',a[ x[i], y[i] ],' ');
end.
<u>PascalABC.NET 3.3.5, сборка 1662 от 29.04.2018</u>
<u>Внимание! Если программа не работает, обновите версию!</u>
begin
var n:=ReadInteger('n=');
if n.Between(2,10) then begin
var i:=1;
repeat
Write(n,'x',i,'=',n*i,' ');
i+=1
until i>10;
Writeln
end
else Writeln('Число должно быть от 2 до 10')
end.
<u>Пример</u>
n= 6
6x1=6 6x2=12 6x3=18 6x4=24 6x5=30 6x6=36 6x7=42 6x8=48 6x9=54 6x10=60