思路:
只能向两个方向
累计差值即可
//By SiriusRen #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,xx,yy;long long ans; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d%d",&xx,&yy),ans-=xx,ans+=yy; for(int i=1;i<=n;i++)scanf("%d%d",&xx,&yy),ans+=xx,ans-=yy; printf("%lld ",ans); }