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 N​1​​ a​N​1​​​​ N​2​​ a​N​2​​​​ ... N​K​​ a​N​K​​​​

where K is the number of nonzero terms in the polynomial, N​i​​ and a​N​i​​​​ (,) are the exponents and coefficients, respectively. It is given that 1,0.

Output Specification:

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.

Sample Input:

2 1 2.4 0 3.2
2 2 1.5 1 0.5

Sample Output:

3 2 1.5 1 2.9 0 3.2

分析: 多项式加法,水题~
 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-23-20.32.18
 * Description : A1002
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;
 ;
 };
 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     ;
     double a;
     scanf("%d",&k);
     ;i<k;i++){
         scanf("%d%lf",&n,&a);
         p[n]+=a;
     }
     scanf("%d",&k);
     ;i<k;i++){
         scanf("%d%lf",&n,&a);
         p[n]+=a;
     }
     ;i<maxn;i++){
         ){
             num++;
         }
     }
     printf("%d",num);
     ;i>=;i--){
         ){
             printf(" %d %.1f",i,p[i]);
         }
     }
     ;
 }

1002 A+B for Polynomials (25 分)的更多相关文章

  1. PAT (Advanced Level) Practice 1002 A+B for Polynomials (25 分) 凌宸1642

    PAT (Advanced Level) Practice 1002 A+B for Polynomials (25 分) 凌宸1642 题目描述: This time, you are suppos ...

  2. PAT Advanced 1002 A+B for Polynomials (25 分)(隐藏条件,多项式的系数不能为0)

    This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each ...

  3. PAT 1002 A+B for Polynomials (25分)

    题目 This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: E ...

  4. 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 ...

  5. 【PAT甲级】1002 A+B for Polynomials (25 分)

    题意:给出两个多项式,计算两个多项式的和,并以指数从大到小输出多项式的指数个数,指数和系数. AAAAAccepted code: #include<bits/stdc++.h> usin ...

  6. 1002 A+B for Polynomials (25分) 格式错误

    算法笔记上能踩的坑都踩了. #include<iostream> using namespace std; float a[1001];//至少1000个位置 int main(){ in ...

  7. P1002 A+B for Polynomials (25分)

    1002 A+B for Polynomials (25分)   This time, you are supposed to find A+B where A and B are two polyn ...

  8. PAT 1009 Product of Polynomials (25分) 指数做数组下标,系数做值

    题目 This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: E ...

  9. PAT甲级 1002 A+B for Polynomials (25)(25 分)

    1002 A+B for Polynomials (25)(25 分) This time, you are supposed to find A+B where A and B are two po ...

  10. 1002 A+B for Polynomials (25)(25 point(s))

    problem 1002 A+B for Polynomials (25)(25 point(s)) This time, you are supposed to find A+B where A a ...

随机推荐

  1. request应用实例

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"% ...

  2. MyEclipse移动开发教程:设置所需配置的iOS应用(四)

    MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] 三.创建配置文件 Provisioning profiles授权文件应用程序在iOS设备上安装并运 ...

  3. SharePoint Word Service-PowerShell

    1. 配置转换进程 Set-SPWordConversionServiceApplication –Identity "Word Automation Services" –Act ...

  4. 2018-2019-2 网络对抗技术 20165202 Exp4 恶意代码分析

    博客目录 一.实践目标 二.实践内容 1.系统运行监控 2.恶意软件分析 三.实验步骤 四.基础问题回答 五.遇到的问题及解决 六.实验总结 一.实践目标 监控你自己系统的运行状态,看有没有可疑的程序 ...

  5. FTP 主动模式 与被动模式

    今天在被电信运营商给的没有内网ip被nat后的内网ip访问我的ftp服务器时出现了,连接被关闭的错误,经过多番查询发现问题原因是因为NAT内网ip没有被有效地转换为外网ip,也即是说NAT对ftp协议 ...

  6. Python mode_+

    f = open("葫芦小金刚", mode="r+", encoding="utf-8") content = f.read(2) # 顺 ...

  7. git stash,git cherry-pick

    git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致.同时,将当前的工作区内容保存到Git栈中.git stash pop: 从Git栈中读取 ...

  8. CentOS7安装OpenStack(Rocky版)-08.启动一个虚拟机实例

    安装完openstack的必要组件keystone,nova,glance,neutron以后就可以使用openstack命令创建一台云虚拟机了 ------------------- 完美的分割线 ...

  9. Java第八次作业--数据库编程

    Deadline: 2017-5-18 23:00 一.学习要点 认真看书并查阅相关资料,掌握以下内容: 掌握应用JDBC访问数据库的基本步骤 掌握DriverManager类.Connection接 ...

  10. Springboot整合pagehelper分页

    一.在pom中添加依赖 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId&g ...