| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11132 | Retrieving Matrix Element |
|
| 11133 | String Reverse |
|
Description
A matrix of dimension (M,N) has M*N elements in the format of M rows(橫列) and N columns(直行), and thus each element has a pair of index (i, j), where i is less than M, j is less than N, and both are greater or equal to 0. For example, a matrix A of dimension (2, 3) may look like this:
[ 1 3 5 ]
[ 2 4 6 ]
where the element A(0,1) is 3 and A(1, 0) is 2.
In this problem, a matrix and a few indexes is given. What you have to do is to find out the corresponding elements from the matrix according to the given indexes.
Input
The input consists of four parts.
- The dimentsion of the matrix: two positive integers M and N in one line, and both are less than 10.
- The matrix itself: M lines and each line contains N integers that can be represented in an int type in C/C++ language.
- The number of index pairs: a positive integer P in one line, an it is less than 5.
- The indexes: P lines and each line contains 2 integers, which represent the two-dimensional index of P elements respectively.
Output
The output be P lines, where P is the given number in the third part of the input. Each line should be exactly one integer that is the corresponding element in the given matrix.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a string S, output the reverse of S.
Input
The input consists of many lines. Each line is a string S with length <= 1000.
The string S does not contain any spaces.
Output
Output the the reverse of S. One in each line.
Print '\n' at the end of each line.