标签:while cstring int can algorithm event i++ bsp pen
#include <iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; int cmp(int a,int b) { return a>b; } int a[100000],b[100000]; int main() { int n; int t; int sum; scanf("%d",&t); while(t--) { sum=0; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n,cmp); for(int i=0;i<n;i++) { scanf("%d",&b[i]); } sort(b,b+n); sum=0; for(int i=0,j=0;i<n,j<n;i++,j++) { sum += (a[i]-b[j])*(a[i]-b[j]); } printf("%d\n",sum);//错了,lld!! } return 0; }
标签:while cstring int can algorithm event i++ bsp pen
原文地址:http://www.cnblogs.com/Roni-i/p/7255451.html