Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
File size: 1,193 Bytes
df6dd12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
A polynomial in `x` of degree **D** can be written as:

    aDxD + aD-1xD-1 + ... + a1x1 + a0

In some cases, a polynomial of degree `**D**` can also be written as the
product of two polynomials of degrees `**D1**` and `**D2**`, where `**D = D1
\+ D2**`. For instance,

    4 x2 + 11 x 1 + 6 = (4 x1 + 3) * (1 x1 + 2)

In this problem, you will be given two polynomials, denoted `**F**` and
`**G**`. Your task is to find a polynomial `**H**` such that `**G** * **H** =
**F**`, and each `ai` is an integer.

## Input

You should first read an integer `**N ≤ 60**`, the number of test cases. Each
test case will start by describing `**F**` and then describe `**G**`. Each
polynomial will start with its degree `0 ≤ **D** ≤ 20`, which will be followed
by `**D**+1` integers, denoting `a0, a1, ... , aD`, where `-10000 ≤ ai ≤
10000`. Each polynomial will have a non-zero coefficient for it's highest
order term.

## Output

For each test case, output a single line describing `**H**`. If `**H**` has
degree `**DH**`, you should output a line containing `**DH** \+ 1` integers,
starting with `a0` for `**H**`. If no `**H**` exists such that `**G*H=F**`,
you should output "no solution".