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 |
I cheated on the judge.Haha, guys. Guess what. I cheated on the online judge and she accepted the following 1/2*N*(N-1) algorithm !!! 181b with gcc ================================================================= 2373307 hjin 2231 Accepted 76K 873MS GCC 181B 2007-07-22 21:38:11 程序代码: main(){int N,i,j,c[10000];long long s;while(scanf("%d",&N)!=-1){s=0ll;for(i=0;i<N;++i){scanf("%d",c+i);for(j=0;j<i;++j)s+=c[i]>c[j]?c[i]-c[j]:c[j]-c[i];}s<<=1;printf("%I64d\n",s);}} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator