intmain(){ int n,zhishu; double xishu; double ans[1000]; fill(ans,ans+1000,0.0); int temp[1000]; int time=0; int count=0; for (int i = 0; i < 2; ++i) { cin>>n; for (int j = 0; j < n; ++j) { cin>>zhishu>>xishu; if (ans[zhishu]==0.0){ temp[time]=zhishu; time++; count++;
}
ans[zhishu]+=xishu; // 如多相加为0 if (ans[zhishu]==0.0){
count--; } }
} cout<<count; sort(temp,temp+time); for (int k = time-1; k >=0 ; --k) { if (ans[temp[k]]!=0.0){ cout<<" "<<temp[k]<<" "; printf("%.1lf",ans[temp[k]]); }