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 |
牛哥们帮忙看下,谢了哈.runtime#include<stdio.h> main() {long n,a[100],i,j,sum; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); sum=0; for(i=0;i<n;i++) {for(j=0;j<n;j++) {if(a[i]>=a[j]) sum=sum+a[i]-a[j]; else sum=sum+a[j]-a[i]; } } printf("%d\n",sum); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator