
Дан прямоугольный массив, состоящий из различных элементов. В каждой строке выбирается минимальный
элемент, а среди них максимальный элемент. Напечатать номер строки, в которой расположено полученное число.

Ответы на вопрос

Ответ:
var a:array[1..1000]of longint;
b:array[1..500]of longint;
i,j,n,k,l,max,min:longint;
begin
write;
readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
Это проверенный ответ)
Объяснение:



Problem Description
You have been given a rectangular array consisting of different elements. In each row, you need to find the minimum element, and among those minimum elements, you need to find the maximum element. Your task is to print the row number in which this maximum element is located.Solution
To solve this problem, you can iterate through each row of the array and keep track of the minimum element and its row number. After iterating through all the rows, you will have the minimum element and its row number. Then, you can iterate through the row with the maximum element and print its row number.Here is the step-by-step solution:
1. Initialize a variable `min_element` to a very large value (e.g., infinity) and a variable `max_element_row` to 0. 2. Iterate through each row of the array: - For each row, initialize a variable `row_min` to a very large value. - Iterate through each element in the row: - If the current element is less than `row_min`, update `row_min` with the current element. - If `row_min` is less than `min_element`, update `min_element` with `row_min` and `max_element_row` with the current row number. 3. Print the value of `max_element_row`.
Here is an example implementation in Python:
```python def find_max_element_row(array): min_element = float('inf') max_element_row = 0
for row in range(len(array)): row_min = float('inf') for element in array[row]: if element < row_min: row_min = element if row_min < min_element: min_element = row_min max_element_row = row
return max_element_row
# Example usage array = [ [5, 8, 3], [2, 9, 1], [7, 4, 6] ]
max_element_row = find_max_element_row(array) print("The row number with the maximum element is:", max_element_row) ```
In this example, the output will be `1`, indicating that the maximum element is located in the second row (0-based indexing).
Please note that the above code is a general solution. You can adapt it to your specific programming language or requirements as needed.
Note: The code provided above is a general solution to the problem. It is not taken from any specific source.


Похожие вопросы
Топ вопросов за вчера в категории Информатика







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