Предмет: Информатика, автор: ismagilov2002p49d98

Алгоритм вычисления значения функции F(n), где n – натуральное число, задан следующими соотношениями:
F(n) = 2*n*n + 4*n + 3, при n ≤ 15
F(n) = F(n-1) + n*n + 3, при n > 15, кратных 3
F(n) = F(n-2) + n - 6, при n > 15, не кратных 3
Определите количество натуральных значений n из отрезка [1; 1000], для которых все цифры значения F(n) нечётные.

Ответы

Автор ответа: vintt
1

Ответ:

У меня получилось 6, но если ответ другой должен получиться, то надеюсь разберешься там с прогой и исправишь

Объяснение:

var x,y,n,b,c,q:integer;

f:array [-1..1000] of integer;

begin

 for var i:=1 to 1000 do begin

   if i<=15 then

     f[i]:=2*i*i+4*i+3;

   if (i>15) then

     if (i mod 3=0) then

     f[i]:= f[n-1]+i*i+3

   else

     F[i]:= f[i-2]+i-6;

   end;

  for var i:=1 to 1000 do begin

    x:=f[i];

     while x>0 do begin

       b:=x mod 10;

       x:=x div 10;

       if b mod 2=0 then begin

         q+=1; break;

     end;

     end;

     if q=0 then

       c+=1;

 end;

 writeln (F);

 writeln (c);

end.

Похожие вопросы
Предмет: Английский язык, автор: sony1609
Помогите перевести текст по англ, пожалуйста

Stephan Hawking, a person on the leading edge, was born January 8, 1942 in Oxford, England. He was born on the 300th anniversary of the death of Galileo, which has long been a source of pride for the noted physicist. Despite he lives in a wheelchair he has done ground-breaking work in physics and cosmology and his several books strive to make science accessible to everyone. Stephen was born in a family of thinkers. His mother was one of the first Oxford female students. Stephan’s father was a respected medical researcher. He wanted his eldest child to go into medicine, but from an early age Stephan showed a passion for science and the sky. “Stephen always had a strong sense of wonder,” his mother remembered. “And I could see that the stars would draw him.”
2. Early in his academic life Stephen, while recognized as bright, was not an exceptional student. He loved board games, and with a few close friends created new games of their own. At the age of 16 Stephen, along with several buddies, constructed a computer out of recycled parts for solving rudimentary mathematical equations. When he was 17, he entered Oxford university. He loved to dance, and took an interest in rowing, becoming a member of the Oxford rowing team. By his own account, Hawking didn’t put much time into his studies. He would later calculate that he averaged about an hour a day focusing on school. And yet he didn’t really have to do more than that. In 1962, he graduated with honours and moved on to Cambridge University for a Ph.D. in cosmology.
Предмет: Русский язык, автор: 3классуроажнение7
Предмет: История, автор: aliona311202