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

why wrong 指点一下

Posted by wangfengtian at 2008-12-07 19:33:53 on Problem 2231
#include<stdio.h>
#include<math.h>
void main()
{
	int a[10000],n,s,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0,s=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
			s=s+2*abs(a[i]-a[j]);
	}
	printf("%d\n",s);
}

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