Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

牛哥们帮忙看下,谢了哈.runtime

Posted by kuangwenkui at 2007-06-16 14:27:39 on Problem 2231
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator