菜鸟记录PAT甲级1002--Polynomials

  开始前有必要说一下,这才第二题就碰到了烂尾题,以自己开始的思路交了n次,错了n词,最后才19分,后来看了一下大佬的c++代码(尽然没有c的代码),还好c和c++的差别不是特别大,仔细琢磨一遍后突然发现很多地方可以改进,整理思路在此尝试终于AC,这才第二题啊。。。。

成都创新互联公司主营东胜网站建设的网络公司,主营网站建设方案,成都App制作,东胜h5小程序设计搭建,东胜网站营销推广欢迎东胜等地区企业咨询

This time, you are supposed to findA+BwhereAandBare 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:

KN1aN1N2aN2...NKaNK

whereKis the number of nonzero terms in the polynomial,NiandaNi(i=1,2,,K) are the exponents and coefficients, respectively. It is given that1K10,0NK<<N2<N11000.

Output Specification:

For each test case you should output the sum ofAandBin 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.

Sample Input:

2 1 2.4 0 3.2
2 2 1.5 1 0.5

当前标题:菜鸟记录PAT甲级1002--Polynomials
当前URL:http://cdiso.cn/article/dsoieei.html

其他资讯