М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
patoga79p00pc3
patoga79p00pc3
22.02.2021 19:44 •  Информатика

PS D:\React> npm i -g expo-cli npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https:

changed 1528 packages, and audited 1529 packages in 4m
118 packages are looking for funding
run `npm fund` for details

26 vulnerabilities (10 moderate, 16 high)

To address issues that do not require attention, run:
npm audit fix

To address all issues (including breaking changes), run:
npm audit fix --force

Run `npm audit` for details.

👇
Открыть все ответы
Ответ:
ароаурв
ароаурв
22.02.2021
{неэффективный алгоритм}

const
 k = 100;

type
 maze = array [1..k, 1..k] of integer;
 var
 l : maze;
 n, m: integer;
 i, j: integer;
 c: char;
 t: text;
 w: integer;
 x0, y0: integer;
 x1, y1: integer;

procedure ways(a,b,r:integer);
begin
 if (w = 0) or (r < w) then {нет смысла идти дальше, если текущий путь уже превосходит найденный}
 if (l[a,b] <> -2) then
 if (r < l[a,b]) or (l[a,b] = -1) then {нет смысла идти, если текущая клетка уже была достигнута за меньшее число шагов}
   begin
   l[a,b] := r;
   if (a = x1) and (b = y1) then
     w := r
   else
     begin
     if a <> 1 then ways(a - 1, b, r + 1);
     if b <> 1 then ways(a, b - 1, r + 1);
     if a <> n then ways(a + 1, b, r + 1);
     if b <> m then ways(a, b + 1, r + 1);
     end
   end;
end; 
begin
 assign(t, 'input.txt');
 reset(t);
 w := 0;
 readln(t, n, m);
 readln(t, x0, y0);
 readln(t, x1, y1);
 for i := 1 to n do
   begin
   for j := 1 to m do
     begin
     read(t, c);
     case c of
       '.' : l[i,j] := -1; {будем считать, что если клетка отмечена как -1, то путь к ней еще не найден}
       'X' : l[i,j] := -2; {-2, если клетка непроходима}
       end;
     end;
   readln(t)
   end;
 close(t);
 if (l[x0,y0] <> -2) and (l[x1,y1] <> -2) then
   begin
   l[x0,y0] := 1; {просто трюк, чтобы пройти проверку на (r < l[x0,y0])}
     ways(x0, y0, 0);
   end
 else
  l[x1,y1] := -1;
 writeln(l[x1,y1])
end.
4,4(70 оценок)
Ответ:
сонька177
сонька177
22.02.2021
Var m : array[0..6] of Integer;
  i,k,N : Integer;
Begin
  For i:=0 to 6 do m[i]:=0;
  Readln(N);
  k:=6;
  While N>0 do
  Begin
    If N>=Power(2,k) then
    Begin
      N:=N-Trunc(Power(2,k));
      Inc(m[k]);
    end else Dec(k);
  end;
  For i:=0 to 6 do Writeln(Power(2,i),'  ',m[i],' шт.');
end.

Еще вариант:
Const
  NN = 7;
  money : array[1..7] of Integer = (1,2,4,8,16,32,64);
Var m : array[1..NN] of Integer;
  i,k,N : Integer;
Begin
  For i:=1 to NN do m[i]:=0;
  Readln(N);
  k:=NN;
  While N>0 do
  Begin
    If N>=money[k] then
    Begin
      N:=N-money[k];
      Inc(m[k]);
    end else Dec(k);
  end;
  For i:=1 to NN do Writeln(money[i],'  ',m[i],' шт.');
end.
4,7(42 оценок)
Это интересно:
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ