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

Разделы > Linear Data Structures: Arrays > задача:


51093 - rgb2gray

Задачи раздела

• 51111 - Even Numbers
• 51115 - Pascal Triangle
• 51043 - Genome Sequencing
• 51116 - The Star Triangle
• 51042 - The most frequent k-mer
• 50271 - Factorial
• 50382 - Parkside's Other Triangle
• 51171 Question 3
• 51093 - rgb2gray
• 51165 Question 1
• 51175 Question 2
• 51092 - Even and Odd
• 51095 - Normal and Trace
• 50423 - Numbers square
• 50300 - Matrix
• 50319 - Toll Plazas
• 50977 - Gaussian Elimination

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

Если у вас есть предложения или пожелания по работе 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