您的位置:首页 > 其它

1002. A+B for Polynomials (25)

2016-09-21 01:41 288 查看
题目:1002. A+B for Polynomials (25)

#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
double poly[1000];
set<int,greater<int>> mst;
int main()
{
int k,n;
double a;
cin>>k;
while(k--)
{
cin>>n>>a;
poly
+=a;
mst.insert(n);
}
cin>>k;
while(k--)
{
cin>>n>>a;
poly
+=a;
if(poly
==0) mst.erase(n);
else mst.insert(n);
}
cout<<mst.size();
for(auto x:mst)
printf(" %d %.1lf",x,poly[x]);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: