| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11119 | binary addition |
|
| 11129 | Alphabet Diamond |
|
| 11142 | Matrix Multiplication |
|
Description
Given a positive integer N, transform it to its unsigned binary representation (e.g. 10 => 1010). Your program needs to
output the binary representation of N+1 and the number of carries during the addition in binary representation.
For example, if the input is 11 (in decimal), your program needs to output 1100, because it is the binary representation of 11+1=12. Also your program needs to output 2, because during the binary addition of 11+1, there are two carries generated.
1011 (11 in binary)
+ 0001 (1 in binary)
---------------------------------
1100 (12 in binary)
Input
The input consist of an integer N (0 <= N <= 1022)
Output
The "unsigned" binary representation of N+1 and the number of carries during the binary addition of N+1. Those two numbers are separated by a space. Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input is a positive integer x, and you should print a alphabet diamond which has x layers. The alphabet diamond is in increasing alphabet order (A B C ... Z) from the outer to the inner. (x <= 26 )
Before the first alphabet, you should use only spaces to align the alphabet and, any other types of indentation is not acceptable.
Please note that there is no need to print space after the last alphabet in each line and, you only need to print a newline.
Input
One positive integer x, x<=26.
Output
An alphabet diamond (please refer to the output sample)
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Compute C = A × B, where A, B and C are matrices of size n × m, m × p, and n × p, respectivily.
Input
There are multiple (≤50) test cases in each data set.
Each case begins with a line of three integers n, m and p, which denote the dimensions of the matrices defined in the problem description. Each of the following n lines contains m integers aij, representing the elements in matrix A, and then m lines of p integers bij, representing the elements in matrix B.
There is a blank line between two successive test cases, and the input is terminated by end-of-file.
For data set #1, 1 ≤ n, m, p ≤ 5 and |aij|, |bij| ≤ 30.
For data set #2, 1 ≤ n, m, p ≤ 20 and |aij|, |bij| ≤ 500.
For data set #3, 1 ≤ n, m, p ≤ 50 and |aij|, |bij| ≤ 7000.
For data set #4, 1 ≤ n, m, p ≤ 100 and |aij|, |bij| ≤ 10000.
Output
For each test case, output n lines of p integers representing the elements of matrix C.
Please use single space to seperate two successive elements in the same line, and do not output any leading or trailing space characters.
Also, please output a blank line after each matrix.