В
Все
Б
Биология
Б
Беларуская мова
У
Українська мова
А
Алгебра
Р
Русский язык
О
ОБЖ
И
История
Ф
Физика
Қ
Қазақ тiлi
О
Окружающий мир
Э
Экономика
Н
Немецкий язык
Х
Химия
П
Право
П
Психология
Д
Другие предметы
Л
Литература
Г
География
Ф
Французский язык
М
Математика
М
Музыка
А
Английский язык
М
МХК
У
Українська література
И
Информатика
О
Обществознание
Г
Геометрия
mur181
mur181
11.05.2022 06:41 •  Информатика

Записать выражения в общепринятую форму : 1. а+b/c+d 2. (a*b+c*d)/b+d 3. (a*x/2+b)/(c*x/2+d) 4. sqrt(a*sqr(x)+b*c+d) 5. abs(x)+sqr(x+1)-sqrt(y) 6. (1.2*a/d+b)*(2.3*c*x*x)

Показать ответ
Ответ:
Дмитртй11
Дмитртй11
08.08.2021 00:20
// PascalABC.Net 3.0, сборка 1066

const
  n=5;
var
  a:array[1..n,1..n] of integer;
  x:array[1..n] of double;
  i,j,k:byte;
begin
  Randomize;
  Writeln('*** Исходный массив ***');
  for i:=1 to n do begin
    for j:=1 to n do begin
      a[i,j]:=Random(51)-25;
      Write(a[i,j]:4)
      end;
    Writeln
  end;
  Writeln('*** Массив x ***');
  for j:=1 to n do begin
    x[j]:=0; k:=0;
    for i:=1 to n do
      if a[i,j] mod 2=0 then begin
        x[j]:=x[j]+a[i,j]; Inc(k)
      end;
    if k>0 then x[j]:=x[j]/k;
    Write(x[j]:0:5,' ')
    end;
  Writeln
end.

Тестовое решение:
*** Исходный массив ***
 -10  18  -8 -15   5
 -21 -18   6  -2   9
  -7  22  -4   3  14
  21  16 -10 -18  -9
  17   3 -14 -18  12
*** Массив x ***
-10.00000 9.50000 -6.00000 -12.66667 13.00000
0,0(0 оценок)
Ответ:
53490
53490
30.12.2020 17:24

С++20

#include <iostream>#include <vector>class Point {public:    int x, y;    Point() = default;    Point(const Point &) = default;    Point(int _x, int _y) : x(_x), y(_y) {}    Point operator + (const Point& p) const {        return Point {x + p.x, y + p.y};    }    Point operator - (const Point& p) const {        return Point {x - p.x, y - p.y};    }    std::vector<Point> operator & (const Point& p) const {        return std::vector<Point> {                Point {x + p.x, y + p.y},                Point {x - p.x, y + p.y},                Point {x + p.x, y - p.y},                Point {x - p.x, y - p.y},                Point {x + p.y, y + p.x},                Point {x - p.y, y + p.x},                Point {x + p.y, y - p.x},                Point {x - p.y, y - p.x},        };    }    static Point max (const Point& p1, const Point& p2) {        return Point {std::max(p1.x, p2.x), std::max(p1.y, p2.y)};    }    static Point min (const Point& p1, const Point& p2) {        return Point {std::min(p1.x, p2.x), std::min(p1.y, p2.y)};    }    [[nodiscard]] int distance_to_by_ch (const Point & p) const {        return std::max(std::abs(p.x - x), std::abs(p.y - y));    }    [[nodiscard]] int distance_to_by_m (const Point & p) const {        return std::abs(p.x - x) + std::abs(p.y - y);    }    friend std::ostream &operator << (std::ostream &os, Point const &p) {        return os << "(" << p.x << ";" << p.y << ")";    }    Point & operator = (const Point &) = default;    bool operator == (const Point & p) const {        return x == p.x && y == p.y;    }};class Horse {public:    const Point p;    explicit Horse (const Point position) : p(position) { }    [[nodiscard]] bool can_I_kill_this_guy (const Point & m) const {        auto field = p & Point{2, 3};        return std::find(field.begin(), field.end(), m) != field.end();    }};std::istream &to_number(std::istream &stream) {    char ch;    do {        ch = stream.get();    }    while (!isalpha(ch));    if (isupper(ch)) ch -= 16; else ch -= 48;    stream.putback(ch);    return stream;}int main () {    Point horse_p{}, stranger_p{};    std::cin >> horse_p.x >> to_number >> horse_p.y;    std::cin >> stranger_p.x >> to_number >> stranger_p.y;    Horse jack(horse_p);    std::cout << "I am a Horse placed on " << jack.p << ". "              << "Can I kill those guy on " << stranger_p << "? "              << "-> " << std::boolalpha << jack.can_I_kill_this_guy(stranger_p); }
Поле шахматной доски определяется парой – буква и цифра. Буква (a … h) означает горизонталь при счет
Поле шахматной доски определяется парой – буква и цифра. Буква (a … h) означает горизонталь при счет
Поле шахматной доски определяется парой – буква и цифра. Буква (a … h) означает горизонталь при счет
0,0(0 оценок)
Популярные вопросы: Информатика
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота