有两个测试点没有通过
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
using namespace std;
bool COM(int a,int b)
{
return a>=b;
}
int main()
{
int tem_n;
double tem_aN;
int number=0;
double aN[1001];
int n[22];
int K1,K2;
memset(aN,0,1001*sizeof(double));
cin>>K1;
for(int i=0;i<K1;i++)
{
cin>>tem_n>>tem_aN;
n[i]=tem_n;
aN[tem_n]+=tem_aN;
number++;
}
cin>>K2;
for(int i=0;i<K2;i++)
{
cin>>tem_n>>tem_aN;
if(aN[tem_n]==0)
{
aN[tem_n]=tem_aN;
n[number++]+=tem_n;
}
else
{
n[number]=tem_n;
aN[tem_n]+=tem_aN;
}
if(aN[tem_n]==0)
number--;
}
sort(n,n+number,COM);
cout<<number;
for(int i=0;i<number;i++)
{
printf(" %d %.1f",n[i],aN[n[i]]);
}
return 0;
}