Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
暴力C500+MS,G++900+MS#include<stdio.h> #include<stdlib.h> int i,j,n,a[10001]; long long ans; int main(){ scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } ans=0; for(i=0;i<n;i++){ for(j=0;j<i;j++){ ans+=abs(a[i]-a[j]); } } ans*=2; printf("%lld",ans); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator