菜鸟记录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
标题链接:http://csruizhi.cn/article/dsoieei.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 成都网站建设公司 LED网站设计方案 企业网站建设公司 响应式网站建设 手机网站制作 响应式网站设计 成都品牌网站设计 营销型网站建设 营销型网站建设 网站建设公司 成都网站建设 公司网站建设 营销网站建设 成都网站制作 定制网站建设 上市集团网站建设 成都企业网站建设公司 成都网站建设公司 企业网站制作 定制网站建设多少钱 成都网站设计 成都网站建设