#include<stdio.h>
#include<string.h>
float a[1001];
int main(){
float q;
int m,n,t;
memset(a,0,sizeof(int));
scanf("%d",&m);
while(m --){
scanf("%d%f",&t,&q);
a[t] = q;
}
scanf("%d",&n);
while(n --){
scanf("%d%f",&t,&q);
a[t] = a[t] + q;
}
int j = 0;
for(int i = 0;i <= 1000;i ++){
if(a[i]){
j ++;
}
}
printf("%d",j);
for(int i = 1000;i >= 0;i --){
if(a[i] != 0){
printf(" %d %.1f",i,a[i]);
}
}
printf("\n");
return 0;
}
pat 1002. A+B for Polynomials
最新推荐文章于 2021-10-30 09:34:18 发布