| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10311 | Polynomial |
|
| 10423 | String swapping |
|
| 10424 | Max pooling |
|
Description
There are two polynomial equations f(x) and g(x).
f(x)=(am xm+a(m-1) x(m-1)+⋯+a1 x1+a0 x0)n
g(x)=cp xp+c(p-1) x(p-1)+⋯+c1 x1+c0 x0
,where n,m,p∈N,0≤p<100.
In this problem, we define g(x) as the expand form of f(x). For example, if f(x)=(x+3)2, then g(x)= x2+6x+9.
Note that all the coefficients are integers.
Input
m
am a(m-1) … a1 a0
n
Output
cp c(p-1) … c1 c0
Note that you need to use “%5d” to print answer and there is a new line at the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The first line of the input is a string.
You may read it using scanf() with %s format.
The second line of the input contains a list of positive integers and ends with a #.
You may read it using
while(scanf("%d", &num[i])==1) i++;
Example:
ABCDEFGHIJ
5 3 8 6 #
The first number 5 means that we need to swap the first five characters with the remaining characters in the input string. After performing this operation, the original string, which is ABCDEFGHIJ, will become FGHIJABCDE.
The next number is 3, so the string becomes IJABCDEFGH.
The next number is 8, and the string becomes GHOJABCDEF.
The final number is 6, so the output string is CDEFGHIJAB.
Input
The first line is a string. Its length is from 2 to 10.
The second line is a list of positive integers. There are at most 20 integers.
Output
Print the final string after performing all operations.
You do not need to print a newline at the end. (No '\n')
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input is an N by N matrix and the output is a new (N-2) by (N-2) matrix. Each element of the new matrix corresponds to the maximum value in each 3 by 3 region of the original matrix.
For example, if the original matrix is
10 20 30 90 30
50 60 30 20 50
80 50 70 60 20
90 40 30 20 80
20 30 40 50 90
then the new matrix will be
80 90 90
90 70 80
90 70 90
Input
The first number is the matrix size N, where 3 <= N <= 10.
The following N*N numbers are the elements of the N by N matrix.
The elements are all positive integers, ranging from 1 to 99.
Output
A new (N-2) by (N-2) matrix
Use “%3d” to print each element and add a newline at the end of each row.
You need to print a newline character at the end of each line. ('\n')