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

lld->I64d , See FAQ..

Posted by bluewind at 2007-11-01 09:14:19 on Problem 2231
In Reply To:sos!!! Posted by:jimi at 2007-11-01 09:07:21
> 主程:
>                 for(i=0;i<n;i++)
> 			scanf("%ld",&a[i]);
> 		qsort(a,n,sizeof(long),cmp);
> 		n = (n-1) * 2;
> 		sum = 0;
> 		for(i=0,k=0,j=n;i<=n;i+=2,j-=2,k++)
> 			sum+=a[k]*(i-j);
> 		printf("%lld\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