PAT甲级——1002 A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials.
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
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int k;
int m,n,sum=0;
double t;
double a[2001]={};
cin>>m;
for(int i=0;i<m;i++)
{
scanf("%d %lf",&k,&t);
a[k]+=t;
}
cin>>n;
for(int i=0;i<n;i++)
{
scanf("%d %lf",&k,&t);
a[k]+=t;
}
for(int j=0;j<1999;j++)
{
if(a[j]!=0)
{
sum++;
}
}
cout << sum;
for(int j=1999;j>=0;j--)
{
if(a[j]!=0)
{
printf(" %d %.1f",j,a[j]);
}
}
return 0;
}
PAT甲级——1002 A+B for Polynomials的更多相关文章
- PAT 甲级 1002 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 polyno ...
- 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 ...
- PAT 甲级1002 A+B for Polynomials (25)
1002. A+B for Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue T ...
- PAT 甲级 1002 A+B for Polynomials
https://pintia.cn/problem-sets/994805342720868352/problems/994805526272000000 This time, you are sup ...
- pat甲级1002
1002. A+B for Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue T ...
- 【PAT】1002. 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 polynom ...
- PAT——甲级1009:Product of Polynomials;乙级1041:考试座位号;乙级1004:成绩排名
题目 1009 Product of Polynomials (25 point(s)) This time, you are supposed to find A×B where A and B a ...
- 甲级1002 A+B for Polynomials (25)
题目描述: This time, you are supposed to find A+B where A and B are two polynomials. Input Each input fi ...
- 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 ...
随机推荐
- js 数据
非0数字值 都是true 0和NaN 都是false 任何对象 都是true null 都是false undefined 不适用 详情
- POJ 1745:Divisibility 枚举某一状态的DP
Divisibility Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11001 Accepted: 3933 Des ...
- ROS的Target Platforms
问题 今天编译VIORB遇到了以下错误: 查到的资料 ubuntu18安装的二进制ros包需要特定版本的库函数 ros官方文档 文档pdf 参考回答 参考回答pdf
- 程序中出现list assignment index out of range的解决方法
class stack: def __init__(self): self.num = 0 self.elem=[] def isEmoty(self): if self.num == 0: prin ...
- Digital Twin——IoT的下一个浪潮
选自Medium 作者:Tomasz Kielar 京东云开发者社区编译 当前的商业格局受到了众多新技术的影响,有时确实让人很难能跟上技术迭新的速度.虽然很多人都熟悉工业4.0和物联网(IoT)这两个 ...
- 201609-2 火车购票 Java
思路待补充 import java.util.Scanner; class Main{ public static void main(String[] args) { //100个座位 int[] ...
- 康冕峰IT技术总结博客CSDN索引
计算1-x内的质数, 结果保存在mysql中. Java 程序员面试笔试宝典 4.1基础知识https://blog.csdn.net/qq_40993412/article/details/1040 ...
- HDU 3018 欧拉回路
HDU - 3018 Ant Country consist of N towns.There are M roads connecting the towns. Ant Tony,together ...
- NFS工作原理简述
1.首先用户访问网站程序,由程序在NFS客户端发出存取NFS文件的请求,NFS客户端上的RPC服务通过网络向NFS服务器的RPC服务的111端口发出NFS文件存取的询问请求. 2.NFS服务器的RPC ...
- Thinkcmf截取内容长度
例1: {$vo.post_title|msubstr=0,10} 截取标题,msubstr=0,10,数字表示截取的字符串长度,显示省略号,但无论长度是否超过截取的长度都会出现省略号: 例2: {$ ...