Files
PAT/html/a1002.html
T

19 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h1>1002. A+B for Polynomials (25)</h1>
<div id="problemContent">
<p>This time, you are supposed to find A+B where A and B are two polynomials.</p>
<p><b>Input</b></p>
<p>Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:
K N1 a<sub>N1</sub> N2 a<sub>N2</sub> ... NK a<sub>NK</sub>, where K is the number of nonzero terms in the polynomial, Ni and a<sub>Ni</sub> (i=1, 2, ..., K) are the exponents and coefficients, respectively. It is given that 1 &lt;= K &lt;= 10,0 &lt;= NK &lt; ... &lt; N2 &lt; N1 &lt;=1000.
<p>
<p><b>Output</b></p>
<p>For each test case you should output the sum of A and B in one line, with the same format as the input. Notice that there must be NO extra space at the end of each line. Please be accurate to 1 decimal place. </p>
<b>Sample Input</b><pre>
2 1 2.4 0 3.2
2 2 1.5 1 0.5
</pre>
<b>Sample Output</b><pre>
3 2 1.5 1 2.9 0 3.2
</pre>
</p></p></div>