HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51084 - Reflect a matrix

Guest
• Review clarifications (2)

Section problems

• 50829 - Decode an Image
• 51044 - Number of Trees
• 50876 - He is my cousin
• 51098 - Rotate a matrix
• 50838 - Balanced Numbers
• 50851 - Repeated Numbers
• 51061 - The Longest Path
• 51083 - Grades Histogram
• 51084 - Reflect a matrix
• 51011 - Decoding the Path
• 50515 - Lines - Revisited
• 51088 - Number of letters
• 50913 - Manhattan Distance
• 51125 - Filling an Array 3
• 50824 - Sum of Group Maxes
• 50449 - The biggest result
• 51172 - The biggest Minute

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Reflect a matrix

Question: For a course you are required to reflect the given matrix in the given dimension. There is Horizontal (H) and Vertical (V). Write a program that reads a 2D array and the dimension to reflect, then show the new array.

Input specification: Firstly, you will be given two integers (r and c) size of 2D array. Then, you will be given c integers in the following n lines.On the next line, you will be given an integer k; then k chars (V or H) where 1 ≤ (r and c) ≤ 100; 1 ≤ k ≤ 200; numbers in the matrix are less 1001.

Output specification: Show the first line of reflected matrix.

Sample Input Sample Output
5 3
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
2
H V
15 14 13

Explanation: Given array has been first horizontally reflected, then vertically reflected.



Для отправки решений необходимо выполнить вход.

www.contester.ru