POMOGI111PJ
02.08.2022 04:06

Вчем заключается основное отличие пакетных систем от систем с распределением времени? как можно в рамках одной системы объединить возможности обеих указанных систем?

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
123456sa
10.04.2020 17:01
23 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include < iostream> #include < cmath> using namespace std; int main() { int a=0, n, r; cout < < "enter integer n: "; cin> > n; do     {           r = n % 10;     if ( r==3 ) {           cout < < "yes";     a=1;       n=0;     }     n=n/10;         }     while ( n> =1 ); if (a! =1) cout < < "no"; system("pause"); return 0; }
0,0(0 оценок)
Ответ:
Superstylegir
21.02.2023 20:20
1. "Традиционный" вариант
//PascalABC.Net 3.0, сборка 1052
function NOD(a, b: longint): longint;
begin
  while a <> b do if a > b then a := a - b else b := b - a;
  NOD := a
end;

var
  f: Text;
  tNOD: longint;

begin
  Assign(f, 'input.txt'); Reset(f);
  if not Eof(f) then Readln(f, tNOD);
  var n: longint := 1;
  while (not Eof(f)) and (n > 0) and (tNOD > 1) do
  begin
    Readln(f, n);
    if n <> 0 then tNOD := NOD(tNOD, n)
  end;
  Close(f);
  Assign(f, 'output.txt'); Rewrite(f);
  Writeln(f,tNOD);
  Close(f)
end.

2. "Современный" вариант
//PascalABC.Net 3.0, сборка 1052
function NOD(a, b: integer): integer;
begin
  while a <> b do if a > b then a -= b else b -= a;
  Result := a
end;

var
  tNOD: integer := 0;
  n: integer;

begin
  foreach var sn in Readlines('input.txt') do
  begin
    n := StrToInt(sn);
    if tNOD = 0 then tNOD := n
    else
    if n = 0 then break else tNOD := NOD(tNOD, n);
  end;
  WriteAllText('output.txt', IntToSTR(tNOD));
end.

Пример файла input.txt находится во вложении, контрольный результат 4096
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота