#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
std::vector<float> coef(1001, 0);
for(int i = 0; i < 2; ++i){
int k, exp;
float c;
scanf("%d", &k);
for (int j = 0; j < k; ++j){
scanf("%d%f", &exp, &c);
coef[exp] += c;
}
}
int total = 0;
for (size_t i = 0; i < coef.size(); ++i){
if(coef[i]) ++total;
}
printf("%d", total);
for(int i = 1000; i >= 0; --i){
if(coef[i]) printf(" %d %.1f", i, coef[i]);
}
return 0;
}
1002. A+B for Polynomials (25)
最新推荐文章于 2022-03-23 20:57:34 发布