| ||||||||||
| 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:help/是不是我没看懂题,过了的给点指点,看看我的这个错在那,它总是wrong 答案In Reply To:help/是不是我没看懂题,过了的给点指点,看看我的这个错在那,它总是wrong 答案 Posted by:tanxiaohuagg at 2007-07-21 15:12:03 > #include<stdio.h>
> #include<math.h>
> main()
> {
> long int a[100000],n,i,j,s,x,b,t;
> i=0;
> s=2147483647;
> scanf("%d",&n);
> while(i<n&&n>=2&&n<=100000&&scanf("%d",&a[i])&&a[i]<=10000000&&a[i]>=1)
> {
> i++;
> }
> for(i=0;i<n;i++)
> {b=0;
> for(j=0;j<n;j++)
> {
> x=fabs(a[i]-a[j]);
> if(x<5000000) t=x;
> else t=10000000-x;
> b+=t;
> }
> if(b<s)s=b;
> }
> printf("%d\n",s);
>
> }
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator