| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 9460 | Matrix Multiplication |
|
| 9461 | Encryption |
|
| 9462 | Parentheses Matching |
|
| 9463 | GCD |
|
| 9464 | Binary Addition |
|
Description
Input
First line contains a positive integer t (t<=50), which indicates the numbers of test cases in the input. The first line of each test case contains three positive integers m, n, p for the dimension of matrices. In the next m lines, each line contains n integers, representing the elements of matrix A. Followed by n lines, each line containing p integers, represent the elements of matrix B. All elements of A and B are integers in the range [-3000, 3000].
Case 1: m, n, p <= 10.
Case 2: m, n, p <= 50.
Case 3: m, n, p <= 100.
Case 4: m, n, p <= 500.
Output
For each case, output an m*p matrix in m lines and each line contains p integers.
Use one space between two consecutive integers. Output a blank line after each case.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
We can encrypt a string into other string. One method is to put a string into an n×n array first, where n is the smallest number such that n2 is equal to or larger than the length of the string. Each character is put into a cell of the array, from the top left cell of the array and along neighboring cells in the counterclockwise order. The encrypted string is the output of the row major order. For example, the input string "Greed is good", whose length is 13, are put into a 4×4 array, as shown in the following figure.
The output string is "Googrd e sed i".
If the end of the encrypted string are spaces, don't output them. For example, the output of "Bass GG" is "B Ga Gss".

Input
The input consists of multiple lines. Each line is a test case, containing a string S. The number of test case is less than 100.
Case 1: the length of S is not more than 30.
Case 2: the length of S is not more than 100.
Case 3: the length of S is not more than 500.
Case 4: the length of S is not more than 1000.
Output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Input
The first line of the input contains an integer N (N ≤ 1000) denoting the number of test cases followed by. Each of the next N lines corresponds to a test case, which contains a string consisting of parentheses, and the maximum string length will be no more than 1000. Note that an empty string (a line which contains the newline character only) may be contained in the input and it should be considered as a valid string according to rule (1).
Hint : Stack
Output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given two positive integers a and b, compute the greatest common divisor (GCD) of a and b. The GCD of a and b is the biggest integer that can divide a and b with no reminder.
Input
First line contains a positive integer t (t<=1000), which indicates the number of test cases in the input. In the next t lines, each line contains two positive integers a, b, which are smaller than or equal to 106.
Case 1: t<=100, a, b<=100
Case 2: t<=10000, a, b<=10000
Case 3: t<=20000, a, b<=100000
Case 4: t<=25000, a, b<=1000000
Output
For each case, output the GCD of a and b in a line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please compute the sum of two given n-bit binary numbers.
Input
The first line of the input file contains a positive integer t indicating the number of test cases. The first line of each test case is a positive integer n denoting the length of bits. The second and third lines are the two n-bit binary numbers. The first bit of each binary number is always 0, which guarantees that the sum of the two binary numbers can still be expressed as an n-bit binary number.
Case1 : t<=100, n<=100
Case2 : t<=200, n<=1000
Case3 : t<=300, n<=5000
Case4 : t<=400, n<=10000
Output
For each test case, your program should print the sum in the same format as the binary numbers given in input.