1.题目介绍
polynomial:多项式
exponent:指数
coefficient:系数
2.考察点,难度
高精度题,难度易
3.解题代码
#include<iostream>
using namespace std;
int main()
{
int k, n, sum = 0;
double a, p[1001] = {0};
scanf("%d", &k);
for (int i = 0; i < k; i++){
scanf("%d%lf", &n, &a);
p[n] += a;
}
scanf("%d", &k);
for (int i = 0; i < k; i++){
scanf("%d%lf", &n, &a);
p[n] += a;
}
for (int i = 0; i < 1001; i++) if (p[i]) sum++;
printf("%d", sum);
for (int i = 1000; i >= 0; i--) if (p[i]) printf(" %d %.1f", i, p[i]);
return 0;
}
4.原题地址
https://pintia.cn/problem-sets/994805342720868352/problems/994805526272000000