源代码如下:
#include<iostream>
using namespace std;
typedef struct{
int x;
int y;
}stru;
int main(){
//ios::sync_with_stdio(false);
int n,a,b;
cin>>n>>a>>b;
stru m[a],s[b];
for(int i=0;i<a;i++)
cin>>m[i].x>>m[i].y;
for(int j=0;j<b;j++)
cin>>s[j].x>>s[j].y;
int sum=0;
int i=0,j=0;
while(i<a&&j<b){
if(m[i].x==s[j].x){
sum+=m[i].y*s[j].y;
i++;
j++;
}
else if(m[i].x>s[j].x)
j++;
else
i++;
}
cout<<sum;
}
/*
10 3 4
4 5
7 -3
10 1
1 10
4 20
5 30
7 40
*/
只有60分,不知道那里运行错误了,希望大佬可以解答