| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12242 | CS_2018_SPRING_MID1-1 |
|
| 12243 | CS_2018_SPRING_MID1-2 |
|
| 12244 | CS_2018_SPRING_MID1-3 |
|
Description
Assume that the input array of n positive integers can be cut into two halves (二分之一) that have an equal sum.
Your task is to find the equal sum. (We guarantee that there is always an answer.)
For example, if the input is 2 3 5 6 4, the answer is 10 since 2+3+5=6+4.
Input
The first line contains an integer n (2 <= n <= 1000).
The second line contains n positive integers a1 ~ an (0 <= ai <= 109).
Output
The output is a single line that contains the equal sum.
Remember that you have to put a '\n' at the end of the line, whatever it takes.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a square matrix A and a smaller square matrix B inside A, print the location of B.
For example, if A is
1 2 3 4
5 6 7 8
8 7 6 5
4 3 2 1
and B is
7 8
6 5
, then the answer is
1 2
because B is in row 1 and column 2 in A.
Input
The first line contains two integers m and n, which are the sizes of A and B. (m and n <=20)
The following m lines contain the m rows of elements of A (each row has m integers).
The next n lines contain the n rows of elements of B (each row has n integers).
Output
The output is a line that contains two integers indicating the location of B in A.
The first integer is the row index and the second integer is the column index. The two integers are separated by a whitespace and there is a '\n' at the end of the line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Consider an array A of n integers.
Given a search range [l, r],
find the maximum value inside the search range in A.
Note that 1<= l <= r <= n , and size of the elements in A are constrained in INT32.
Input
The first line contains an integer n. (1<=n<1000)
The second line contains n integers as the elements of A.
The third line contains an integer t.
Each of the following t lines contains two integers l_t and r_t denoting the search range [l_t, r_t] in A.
Output
The output contains t lines.
Each line shows the maximum integer inside the corresponding search range in A.
There is a '\n' at the end of each line.