andreymarshev0p0b1aa
07.03.2023 16:33

Филамент изготавливается из следующих видов
полимерных материалов:
...производится из
биологически разлагаемого
сырья растительного
происхождения
PLA
SBS
HIPS
ABS​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
nikitinaani19
10.07.2022 14:30
// PascalABC.NET 3.1, сборка 1230 от 27.04.2016
begin
  var s:=ReadLines('in.txt').ToArray;
  var n:=StrToInt(s[0]);
  var a:=s[1].ToWords.Select(e->StrToInt(e)).ToArray;
  var f:=OpenWrite('out.txt');
  Writeln(f,n,' - (кол-во чисел)');
  foreach var e in a do Write(f,e,' '); Writeln(f);
  Writeln(f,'Среднее значение четных ',
    a.Where(x->x.IsEven).Average);
  Writeln(f,'Среднее значение нечетных ',
    a.Where(x->x.IsOdd).Average);
  f.Close
end.

Файлы in.txt и out.txt находятся во вложении.

Содержимое файла out.txt:
15 - (кол-во чисел)
-22 49 33 47 -10 -1 20 -18 2 21 2 -25 21 -47 -36
Среднее значение четных -8.85714285714286
Среднее значение нечетных 12.25
0,0(0 оценок)
Ответ:
дошикестдошик
09.07.2020 19:03
Тебя интересует левое верхнее число из матрицы \begin{pmatrix}
1 & 1 \\ 1 & 1
\end{pmatrix}^{12}, что, кстати, является 12 числом фибоначчи

#include <iostream>
// матрица 2 на 2// a  b// c  dtemplate< typename T = int >class matrix2{public:    T a, b, c, d;
    matrix2() : a(0), b(0), c(0), d(0)    {}    matrix2(T a, T b, T c, T d) : a(a), b(b), c(c), d(d)    {}
    matrix2 & operator *= (matrix2 & other)    {        T ta, tb, tc, td;        ta = a * other.a + b * other.c;        tb = a * other.b + b * other.d;        tc = a * other.c + c * other.d;        td = b * other.c + d * other.d;        a = ta, b = tb, c = tc, d = td;    }
    matrix2 operator * (matrix2 & other)    {        T ta, tb, tc, td;        ta = a * other.a + b * other.c;        tb = a * other.b + b * other.d;        tc = a * other.c + c * other.d;        td = b * other.c + d * other.d;        return matrix2(ta, tb, tc, td);    }
    matrix2 pow(int power)    {        matrix2 result(1, 0, 0, 1);        matrix2 cur = *this;        while (power)        {            if (power & 1)            {                power ^= 1;                result *= cur;            }            else            {                power >>= 1;                cur *= cur;            }        }        return result;    }
    void operator = (matrix2 other)    {        a = other.a;        b = other.b;        c = other.c;        d = other.d;    }
    friend std::ostream & operator << (std::ostream & ostr, matrix2 ma)    {        ostr << std::endl;        ostr << ma.a << "  " << ma.b << std::endl;        ostr << ma.c << "  " << ma.d << std::endl;        return ostr;    }
};
int main(void){    matrix2< int > m1(1, 1, 1, 0), tmp;
    const int N = 12;
    std::cout << m1.pow(N).a;
    return 0;}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота