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 |
Re:其实不用的In Reply To:ac了,WA的注意了; Posted by:choupigwb at 2008-11-12 18:00:55 > sort(a,a+n); > __int64 sum=0; > for(i=1;i<n;i++) > sum+=(n-i)*(i)*(a[i]-a[i-1]); > 数组a一定要__int64或者long long, 不然WA; 只需将上面最后一句改为 sum+=(n-i)*(i)*(__int64)(a[i]-a[i-1]); 就可以了,原因自己想一下吧~~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator