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

只能是--int64

Posted by chenxuan123456789 at 2012-07-29 19:15:41 on Problem 2231
#include <stdio.h>
#include <math.h>
#define L 10000
int num[L];
int main()
{
	int i,j,n;
	__int64 sum;
     scanf("%d",&n);
     for(i=0;i<n;i++)
     scanf("%d",&num[i]);
     sum=0;
     for(i=0;i<n;i++)
     	for(j=i+1;j<n;j++)
     	sum+=abs(num[i]-num[j]);
     	printf("%I64d\n",sum*2);
     	return 1;
}
     

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