标签:简单 space stdio.h java 平面 col content title ble
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 20196 Accepted Submission(s): 9150
#include <stdio.h> #include <algorithm> #include <iostream> #include <string.h> #include <queue> #include <cmath> #include <vector> #include <map> using namespace std; int a[550]; int main() { int t,n,ans; scanf("%d",&t); while(t--) { ans=0; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); for(int i=0;i<n;i++) ans+=abs(a[n/2]-a[i]); cout<<ans<<endl; } return 0; }
标签:简单 space stdio.h java 平面 col content title ble
原文地址:http://www.cnblogs.com/a249189046/p/7617985.html