#include<bits/stdc++.h>
using namespace std;
float c[1001];
int main(){
int k1,k2;
cin>>k1;
for(int i=1;i<=k1;i++){
float b;
int a;
cin>>a>>b;
c[a]+=b;
}
cin>>k2;
for(int i=1;i<=k2;i++){
int a;
float b;
cin>>a>>b;
c[a]+=b;
}
int cnt = 0;
for (int i = 0; i < 1001; i++) {
if (c[i] != 0) cnt++;
}
printf("%d", cnt);
for (int i = 1000; i >= 0; i--) {
if (c[i] != 0.0)
printf(" %d %.1f", i, c[i]);
}
return 0;
}
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/244742.html