题目
1002 A+B for Polynomials (25 分)
This time, you are supposed to find A+B where A and B are two polynomials.
Input Specification:
Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:
K N1 aN1 N2 aN2 ... NK aNK
where K is the number of nonzero terms in the polynomial, Ni and aNi (i=1,2,⋯,K) are the exponents and coefficients, respectively. It is given that 1≤K≤10,0≤NK<⋯<N2<N1≤1000.

这篇博客详细介绍了如何解决PTA上的A1002题,即两个多项式的相加问题。输入规格和输出规格被清晰地给出,每个测试用例包含两个多项式,每个多项式由非零项的系数和指数表示。博主分享了代码实现,并指出需要注意最后的空格输出,同时提到《算法笔记》中给出的代码存在一些问题,不适合作为直接参考。


被折叠的 条评论
为什么被折叠?



