ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN_114 Midterm A > задача:


10. 51093 - rgb2gray

CEN_114 Midterm A

Старт: 14.мая.2020 в 00:00:01
Финиш: 31.мая.2020 в 23:55:59
Турнир завершён!
• Турнирная таблица

Задачи турнира

• 1. 50467 - Random Numbers
• 10. 51093 - rgb2gray
• 11. 50410 - Zero Padding
• 12. 50470 - Close Pairs - Revised
• 13. 50735 - Top M Products
• 14. 51094 - Passing the course
• 15. 50804 - Marathon
• 3. 50390 - Total Salary Paid
• 4. 50528 - Rock-Scissors-Paper
• 5. 51087 - Are they the same?

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

rgb2gray

Question: Given 3 two dimensional matrixes, the task is to calculate the average matrix of three matrixes.

Each matrix has different coefficients. The first matrix has coefficients 0.30, second matrix 0.58 and the coefficients for the third matrix is 0.12.

Input specification: In the first line you will be given the dimensions of matrixes (1<=m,n<=350) then in the following lines there are three matrixes size of m by n. Where each element of matrixes is: 1<=element<=100.

Output specification: Show the integer average matrix.

Sample Input I 

3 4
42 98 87 63
15 73 94 60
97 89 12 98
93 15 29 58
71 87 16 85
17 79 31 79
32 32 5 12
47 94 63 3
73 69 17 2

Sample Output I

70 42 44 54
51 84 45 68
48 81 24 75

 

   Sample Input I Explanation
 
The first element (0,0)  of average matrix is calculatin in this way:
avg[0][0]=A[0][0]*0.30 + B[0][0]*0.58 + C[0][0]*0.12
              =42*0.30 + 93*0.58 + 32*0.12
              = 70.38
The nearest integer of 70.38 is 70.
Note: use rand() function to calculate nearest integer of a number.
Для отправки решений необходимо выполнить вход.

www.contester.ru