allknown
18.02.2022 05:26

Задача на картинке, информатика 8 клас

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
mrscom
25.04.2022 20:39
// PascalABC.NET 3.0, сборка 1073
const
  nn=30;
  mm=30;
var
  a:array[1..mm,1..nn] of integer;
  m,n,i,j,k,s:integer;
begin
  Writeln('Введите число строк и столбцов массива: '); Read(m,n);
  Randomize;
  Writeln('*** Исходный массив ***');
  k:=0;
  for i:=1 to m do begin
    for j:=1 to n do begin
      a[i,j]:=Random(51)-25;
      Write(a[i,j]:4);
      if Odd(a[i,j]) then Inc(k)
    end;
    Writeln
  end;
  if k>5 then begin
    Writeln('Средние арифметические отрицательных элементов по строкам');
    for i:=1 to m do begin
      s:=0; k:=0;
      for j:=1 to n do
        if a[i,j]<0 then begin Inc(k); s:=s+a[i,j] end;
      if k>0 then Writeln(s/k:9:5) else Writeln('  0.00000');
    end
  end
  else begin
    Writeln('*** Результирующий массив ***');
    for i:=1 to m do begin
      for j:=1 to n do begin a[i,j]:=2*a[i,j]; Write(a[i,j]:4) end;
    Writeln
    end
  end
end.

Тестовые решения:
Введите число строк и столбцов массива:
8 6
*** Исходный массив ***
 -16  -8  -1  24 -22   1
  -9 -20 -25  13 -11  10
 -15  10 -12  20 -22   3
  -6  25  -3  25 -14  22
  24  -4  24  17  -4 -17
 -23  -9 -22   1 -18 -13
 -12  13   6 -16   2 -13
  19   8 -22  14  -3   4
Средние арифметические отрицательных элементов по строкам
-11.75000
-16.25000
-16.33333
 -7.66667
 -8.33333
-17.00000
-13.66667
-12.50000

Введите число строк и столбцов массива:
3 5
*** Исходный массив ***
   3  24 -21 -22  -8
 -21  14 -22   0 -22
  15 -16  -2   6  22
*** Результирующий массив ***
   6  48 -42 -44 -16
 -42  28 -44   0 -44
  30 -32  -4  12  44
0,0(0 оценок)
Ответ:
lenokm050406
06.10.2022 01:07
Вот на С++:

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cstring>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>typedef unsigned long long ulol;
typedef long double ld;
typedef long long lol;
typedef long int  li;#define mp          make_pair
#define F           first
#define S           second
#define sqr(a)      ( (a) * (a) )
#define pb          push_back
#define INF         999999999
#define ret(a)      cout << endl; system("pause"); return(a)
//#define ret(a)      return(a)using namespace std;int main()
{
    ld x;
    cin >> x;
    x = ( 8 / sqrt( x ) ) + sqrt(x);
    cout << x;
    ret(0);
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота